Skip to main content
Associate III
June 3, 2024
Question

error: unknown type name 'SPI_HandleTypeDef'

  • June 3, 2024
  • 2 replies
  • 2616 views

Hi i encounter this error while compiling SPI1 at ST7735.h, i dont understand as this error 'SPI_HandleTypeDef' type was generated by .ioc in main.c already and i had call this statement in ST7735.h. Could anyone kindly help?

 

error: unknown type name 'SPI_HandleTypeDef'   --> in st7735.h 

 

// st7735.h
#define ST7735_SPI_PORT hspi1
extern SPI_HandleTypeDef ST7735_SPI_PORT; 

 

This topic has been closed for replies.

2 replies

ST Technical Moderator
June 3, 2024

Hello @StanCosgrove ,

Check the settings of "Include Paths" and make sure to define 'USE_HAL_DRIVER' within the project setting.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Tesla DeLorean
Guru
June 3, 2024

Yes, you'll need to pull in the top level HAL include files for those definitions to be brought in by the compiler.

ie #include "stm32f0xx_hal.h"

And stm32f0xx_hal_conf.h will need to have the SPI line uncommented.

/* #define HAL_SPI_MODULE_ENABLED */

There's also obviously a processing order, the definitions need to come in before the usage

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..