Skip to main content
Visitor II
June 3, 2024
Question

error: unknown type name 'SPI_HandleTypeDef'

  • June 3, 2024
  • 2 replies
  • 2535 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

    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.

    Graduate II
    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