Skip to main content
VVakh.1
Associate II
January 4, 2022
Solved

Is it possible to automatically separate the code generated by STM32CubeIDE into headers and source files for each type of peripherals?

  • January 4, 2022
  • 2 replies
  • 3532 views

When I create a new project in STM32CubeIDE with the use of a configuration (.ioc) file, configure peripherals, and generate code, all handlers (such as I2C_HandleTypeDef, UART_HandleTypeDef, QSPI_HandleTypeDef, DMA_HandleTypeDef, etc.) and their initialization functions are placed in main.c file.

Is there a way to automatically split the code into multiple pairs of headers and source files (let's say, a header-source pair for UART, a header-source pair for I2C, etc.)?

I would like to define some custom parameters and functions related to my peripherals. Of course, I can create additional headers and source files. I would just prefer to group them all together without producing multiple files.

Thank you.

This topic has been closed for replies.
Best answer by TDK

> Is there a way to automatically split the code into multiple pairs of headers and source files (let's say, a header-source pair for UART, a header-source pair for I2C, etc.)?

Yes. See the screenshot here:

0693W00000HqYGAQA3.png

2 replies

TDK
TDKAnswer
Super User
January 4, 2022

> Is there a way to automatically split the code into multiple pairs of headers and source files (let's say, a header-source pair for UART, a header-source pair for I2C, etc.)?

Yes. See the screenshot here:

0693W00000HqYGAQA3.png

"If you feel a post has answered your question, please click ""Accept as Solution""."
MKara.13
Associate
July 26, 2022

thanks!

VVakh.1
VVakh.1Author
Associate II
January 4, 2022

Thank you a lot! It helped, my issue is resolved.