Correctly include external files (.c and .h)
Hello,
I am new with STM32CUBE. I have a weather station that I want to couple on the STM32F411 PCB (from Aliexpress). It works when I put the uint8_t WH24P_Data[21] data buffer in main.c. I have made WH24P.c and WH24P.h and I want to declare this buffer in WH24P.c from main.c with including #include "WH24P.h" from main.c. So I can use this external declared buffer in main. But If I move the buffer outside main.c, the data will not be send to the USB CDC. I can't even open the virtual comport. I just placed WH24P.c to Core-Src and WH24P.h to Core-Inc. But how do I import it the correct way? Maybe in a directory like the USB_DEVICE directory (WH24P name instead). How do I know it's included? It failed in the beginning, so that's why I put it in the Core directory at the moment.
This is in WH24P.c
uint8_t WH24P_Data[21];
This is in WH24P.h
extern uint8_t WH24P_Data[21];
Why can't I use this buffer from main.c when it is placed in WH24P.c and .h? The easiest way would be to have a ll the functions in main.c, but I want to make a separate file, so I can easily compile it later for another controller.
So the question in short. How can I include external files in STM32CUBE, so I can access the buffers declared in that other file. Because I am a beginner, please put it simply. Right click this and click that. Thank you very much.
Kind regards,
Ad