2025-09-28 8:47 AM
Hi all
Looking for a way to use macro with external pins ,in a .h file, like I use for variables.
I have a "Global_Var.h" for all external variable like ex: "extern unsigned char gucSPI_ERR"
and in the "SPI.c" I have the "#include Global_Var.h" and "unsigned char gucSPI_ERR" after it,
and everything works fine.
But since I have some pins that I use for MARKERS like ex: "gmMarker1_ON" and and "gmMarker1_OFF"
to be used with a logic analyzer, I can't find a way to do it
I have this "#define gmMarker1 _ON() HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_SET);
#define gmMarker1_OFF() HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET);"
in the "SPI.c" and work fine but since I want to use it from any other files, what would be the best way to do that.
I'm an old PIC programmer but now I need to use STM32 for more power and memories..
For now I'm on Nuleo-L432KC but will soon move to bigger STM products.
STM32 Cube IDE: 1.19.0
Thanks for your help.
2025-09-28 10:54 AM
Hi,
isn't it possible to move both #define... to the h file?