cancel
Showing results for 
Search instead for 
Did you mean: 

How to add APIs

skrowten_hermit
Associate II

I am new to STM32CubeIDE and I was trying to write a simple UART driver using polling method. I was successful when I wrote the function in the main.c and compiled the code.

So, I wanted to make an API of the same function and moved the function to separate .c files (in 01-uart/Core/Src/ i.e., where main.c is placed by default on code generation) and added the declaration in respective .h files (in 01-uart/Core/Inc/ i.e., where main.h is placed by default on code generation) just like in any other C project source code. But this threw 150+ errors on build and all related to HAL types. How do I fix it? It would be helpful if someone could give a pointer on how to do this. Attached below is my source code.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

The only file you should include is "stm32f3xx_hal.h". Look at the generated main.h for an example.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

The only file you should include is "stm32f3xx_hal.h". Look at the generated main.h for an example.

If you feel a post has answered your question, please click "Accept as Solution".

Thanks a lot @TDK​ . My include was clearly wrong. I had #included "stm32f3xx_hal_uart.h" instead.