AnsweredAssumed Answered

Cube and #define USE_HAL_DRIVER...

Question asked by samuel.poiraud.005 on Aug 20, 2015
Latest reply on Aug 20, 2015 by samuel.poiraud.005
Hi,

I'm using cube with HAL driver.. and need your help to understand the right way to include headers.

I do not understand this example:

I includes "stm32f4xx_hal_adc.h" 
"stm32f4xx_hal_adc.h" includes "stm32f4xx_hal_def.h"
 "stm32f4xx_hal_def.h" includes "stm32f4xx.h"
"stm32f4xx.h" defines USE_HAL_DRIVER and includes "stm32f4xx_hal.h"
"stm32f4xx_hal.h" includes "stm32f4xx_hal_conf.h"
"stm32f4xx_hal_conf.h" includes "stm32f4xx_hal_dma.h" (and all the other enabled drivers)
"stm32f4xx_hal_dma.h" uses HAL_StatusTypeDef...

BUT, HAL_StatusTypeDef is define by  "stm32f4xx_hal_def.h" AFTER the inclusion of all these files...
So I get a compilation error!

Should I not define USE_HAL_DRIVER and include modules where there are needed?

Thanks!

Samuel.

Outcomes