2022-05-22 09:58 PM
static bool isEOBtnPressed = FALSE;
static bool isECBtnPressed = FALSE;
static void monitor_d_input_button(void); /*PB1 pin as input pin pull-up mode*/
static void monitor_o_input_button(void);/*PB2 pin as inputpin pu;;-up mode*/
static void monitor_c_input_button(void);/*PB3 pin as inputpin pu;;-up mode*/
static void monitor_e_o_input_button(void);/*PB4 pin as inputpin pu;;-up mode*/
static void monitor_e_c_input_button(void);/*PB5 pin as inputpin pu;;-up mode*/
static void monitor_d_input_button(void)
{
static bool isDefON = FALSE;
volatile bool btnState = !GPIO_ReadInputPin(GPIOB, (GPIO_Pin_TypeDef)GPIO_PIN_1);
if(btnState != isDefON)
{
if(!isDefON)
{
def_timer_tick = 0;
isDefON = FALSE;
}/*btnpressed and defrost is already on and time is less than 10min*/
else if(btnState && isDefON && (def_timer_tick < 600000))
{
isDefON = FALSE;
}
if(isDefON && (def_timer_tick >= 600000))
{
isDefON = FALSE;
}
}
static void monitor_e_o_input_button(void)
{
volatile bool btnState = FALSE;
btnState = !GPIO_ReadInputPin(GPIOB,(GPIO_Pin_TypeDef)GPIO_PIN_4);
if(btnState && (isEOBtnPressed ==FALSE))
{
isEOBtnPressed = FALSE;
}
else if (!btnState)
{
isEOBtnPressed = FALSE;
}
}
static void monitor_e_c_input_button(void)
{
volatile bool btnState = !GPIO_ReadInputPin(GPIOB, (GPIO_Pin_TypeDef)GPIO_PIN_5);
if(btnState && !isECBtnPressed)
{
isECBtnPressed = FALSE;
}
else if(!btnState)
{
isECBtnPressed = FALSE;
}
}
static void monitor_o_input_button(void)
{
volatile bool btnState = !GPIO_ReadInputPin(GPIOB, (GPIO_Pin_TypeDef)GPIO_PIN_2);
if(btnState)
{
/*send command and make close command 0*/
}
else
{
/* make command to 0 and send*/
}
}
static void monitor_c_input_button(void)
{
/*read defrost button input*/
volatile bool btnState = !GPIO_ReadInputPin(GPIOB, (GPIO_Pin_TypeDef)GPIO_PIN_3);
if(btnState)
{
/*send command and make close command 0*/
}
else
{
/*make close command to 0 and send*/
}
}
2022-05-23 02:36 AM
Hi AAnsa,
It would be nice to have the piece of code associated with the error, and the line numbers of the code.
But from what we can see here, there is a missing '}' at the end of your function "static void monitor_d_input_button(void)".
It is more obvious when the code is indented :
static void monitor_d_input_button(void)
{
static bool isDefON = FALSE;
volatile bool btnState = !GPIO_ReadInputPin(GPIOB, (GPIO_Pin_TypeDef)GPIO_PIN_1);
if(btnState != isDefON)
{
if(!isDefON)
{
def_timer_tick = 0;
isDefON = FALSE;
}/*btnpressed and defrost is already on and time is less than 10min*/
else if(btnState && isDefON && (def_timer_tick < 600000))
{
isDefON = FALSE;
}
if(isDefON && (def_timer_tick >= 600000))
{
isDefON = FALSE;
}
}
static void monitor_e_o_input_button(void)
{
I hope it helps,
Bastien
2022-05-23 10:24 AM
Yes you are right, missing } was cause error.