STM32CubeMX removes spi.h include as soon as QUADSPI peripheral is activated
It's not a big deal but this got me confused for a moment when I suddenly got compiler warnings.
Steps to reproduce:
- Start a new project in STM32CubeIDE
- Use STM32L422RBI MCU, default settings, finish
- CubeMX: Enable SPI1 peripheral, Full-Duplex Master, default configuration
- CubeMX: Project Manager > Code Generator > Enable "Generate peripheral initialization as a pair of '.c/.h' files per peripheral"
- Save IOC, generate code, build project: observe 0 errors, 0 warnings
- Note that in Core/main.c, there is a line #include "spi.h"
- Open IOC in CubeMX again
- CubeMX: Activate QUADSPI peripheral, Bank1 with Single/Dual Lines, default configuration
- Save IOC, generate code, build project: observe 0 errors, 1 warning: "implicit declaration of function 'MX_SPI1_Init'; did you mean 'MX_GPIO_Init'? [-Wimplicit-function-declaration]"
- Observe that #include "spi.h" has been replaced by #include "quadspi.h"
This can easily be fixed manually by adding the missing include below in the user includes but still, it should be fixed in the CubeMX code generator.
Thanks!
