what to include in header and source files
I generated project with CubeIDE for Nucleo F411RE board with defaults.
Now I want to create my own function void LED_blink(int blink_num);
So, I created ledfunc.h and ledfunc.c files.
This is my ledfunc.h file:
#ifndef INC_LEDFUNC_H_
#define INC_LEDFUNC_H_
void LED_blink(int led_number_blink);
#endif /* INC_LEDFUNC_H_ */and this if my ledfunc.c file:
void LED_blink(int led_number_blink) {
for (int i = 0; i < led_number_blink; i++) {
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET);
HAL_Delay(100);
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
HAL_Delay(100);
}
}and I want to use LED_blink(2) function in main.c
( which was generated by CubeIDE )
When I try to build code, I'm getting errors LD2_GPIO_Port undefined
Yes, those defined in main.h
Where (in which file ) I need to include #include "main.h" ?
I need proper way where to add #include
Edited to apply source code formatting - please see How to insert source code for future reference.
