function macro usage issues in stm32cubeIDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-05-25 8:32 AM
Hello,
I have some issues with function macros usage in my stm32cubeIDE project after importing some generated code in cubeIMX.
This issues come on the back of my work related to this topic : is there any sample for X-NUCLEO-NFC08A1 to be use... - STMicroelectronics Community
And the macro usage issues I have might be similar to the topic here
Multiple "expected expression before 'do'" errors - Page 2 - STMicroelectronics Community
but I could not figure out what is the issue and solution in my case
in rfal_platform.h from the X-CUBE_NFC6 example I have error "expected expression before ',' for these macros:
#define platformGpioSet( port, pin ) HAL_GPIO_WritePin(port, pin, GPIO_PIN_SET) /*!< Turns the given GPIO High */
#define platformGpioClear( port, pin ) HAL_GPIO_WritePin(port, pin, GPIO_PIN_RESET) /*!< Turns the given GPIO Low */
#define platformGpioToogle( port, pin ) HAL_GPIO_TogglePin(port, pin) /*!< Toogles the given GPIO */
#define platformGpioIsHigh( port, pin ) (HAL_GPIO_ReadPin(port, pin) == GPIO_PIN_SET) /*!< Checks if the given LED is High */
expect the TogglePin one.
../X-CUBE-NFC6/Target/rfal_platform.h:99:77: error: expected expression before ',' token
99 | #define platformGpioClear( port, pin ) HAL_GPIO_WritePin(port, pin, GPIO_PIN_RESET) /*!< Turns the given GPIO Low */
| ^
../X-CUBE-NFC6/Target/rfal_platform.h:104:55: note: in expansion of macro 'platformGpioClear'
104 | #define platformLedOff( port, pin ) platformGpioClear(port, pin) /*!< Turns the given LED Off */
| ^~~~~~~~~~~~~~~~~
../Drivers/BSP/Components/ST25R3916/st25r3916_led.c:53:43: note: in expansion of macro 'platformLedOff'
53 | #define st25r3916ledFieldOff() platformLedOff( PLATFORM_LED_FIELD_PORT, PLATFORM_LED_FIELD_PIN ); /*!< LED Field
I mention I did not modify the code generated in cubeIMX
Thanks,
Mihai
- Labels:
-
STM32CubeIDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-05-27 12:35 AM
I assume this happens when you invoke the st25r3916ledFieldOff() macro?
What do PLATFORM_LED_FIELD_PORT and PLATFORM_LED_FIELD_PIN expand as?
