2019-02-12 08:59 PM
Ok, another noob question....
I can use the following line of code in the main.c with no issues
#define Green_LED_OFF HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET); // Green off
But when I want to use it in another .c file such as foo.c I get the error "
'GPIOA' undeclared (first use in this function)" , additionally is says 'GPIO_PIN_RESET' and 'GPIO_PIN_8' are undeclared as well. How do I instruct the foo.c file to understand the HAL instructions?
Thanks
Rusty
2019-02-12 10:49 PM
#define replaces text in the source code.
GPIOA, GPIO_PIN_8, GPIO_PIN-RESET are also defined in different H files.
Grab all the #include at the top of main and paste them in the other source file.
The unelegant crude way.