Getting "expected declaration specifiers or '...' before '(' token" error when using "HAL_GPIO_EXTI_Callback" function.
- April 14, 2020
- 3 replies
- 6219 views
Hi!
I'm currently using a Nucleo-L432KC board to move a servo. There's a pin connected to the Servo (PA_8), a pin for a button interrupt (PA_4) and a pin for a LED indicator (PA_6).
The issue arises when I call the following function:
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){
timer = 0;
HAL_TIM_Base_Start_IT(&htim2);
__HAL_TIM_SetCompare(&htim1, TIM_CHANNEL_1,2);
}
I call it through this line:
HAL_GPIO_EXTI_Callback(GPIO_PIN_4);
Whenever I call the function I get the following error (during build):
../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio.h:88:36: error: expected declaration specifiers or '...' before '(' token
#define GPIO_PIN_4 ((uint16_t)0x0010) /* Pin 4 selected */
^
../Src/main.c:384:26: note: in expansion of macro 'GPIO_PIN_4'
HAL_GPIO_EXTI_Callback(GPIO_PIN_4);
^~~~~~~~~~
I have tried adding & and * in the parameters and arguments but It increases the amount of errors.
Any help would be highly appreciated!!
Edit: I'm using STM32CubeIDE