2017-06-15 12:54 PM
Hi,
I'm trying to develop my own libraries to use a lux sensor MAX44009 with an STM32L476RG-Nucleo. I've modified the example I2C_TwoBoards_ComPolling and using its configuration I was able to set up and read the values even using interrupt of the sensor. Now I would use no more the I2C3 but I want to change on the I2C1. I try to generate the code through CubeMX. But I have some problems, first of all CubeMX doesn't generates/includes the library stm32l4xx_nucleo.h and trying to include stm32l4xx_hal_conf.h (generated by CubeMX) I have this error compiling with the MDK-ARM v5:
../Inc/MAX44009.h(37): error: &sharp20: identifier 'HAL_StatusTypeDef' is undefined
HAL_StatusTypeDef getLux(I2C_HandleTypeDef I2cHandle, float *luxVal);../Inc/MAX44009.h(37): error: &sharp20: identifier 'I2C_HandleTypeDef' is undefined HAL_StatusTypeDef getLux(I2C_HandleTypeDef I2cHandle, float *luxVal);../Inc/MAX44009.h(38): error: &sharp20: identifier 'HAL_StatusTypeDef' is undefined HAL_StatusTypeDef getInterruptStatus(I2C_HandleTypeDef I2cHandle, uint8_t *IT_Status);../Inc/MAX44009.h(38): error: &sharp20: identifier 'I2C_HandleTypeDef' is undefined HAL_StatusTypeDef getInterruptStatus(I2C_HandleTypeDef I2cHandle, uint8_t *IT_Status);../Inc/MAX44009.h(38): error: &sharp20: identifier 'uint8_t' is undefined HAL_StatusTypeDef getInterruptStatus(I2C_HandleTypeDef I2cHandle, uint8_t *IT_Status);../Inc/MAX44009.h(39): error: &sharp20: identifier 'HAL_StatusTypeDef' is undefined HAL_StatusTypeDef setInterruptStatus(I2C_HandleTypeDef I2cHandle, uint8_t *IT_Status);../Inc/MAX44009.h(39): error: &sharp20: identifier 'I2C_HandleTypeDef' is undefined HAL_StatusTypeDef setInterruptStatus(I2C_HandleTypeDef I2cHandle, uint8_t *IT_Status);../Inc/MAX44009.h(39): error: &sharp20: identifier 'uint8_t' is undefined HAL_StatusTypeDef setInterruptStatus(I2C_HandleTypeDef I2cHandle, uint8_t *IT_Status);../Inc/MAX44009.h(57): error: &sharp20: identifier 'HAL_StatusTypeDef' is undefined HAL_StatusTypeDef setThreshold_Lux(I2C_HandleTypeDef I2cHandle,../Inc/MAX44009.h(57): error: &sharp20: identifier 'I2C_HandleTypeDef' is undefined HAL_StatusTypeDef setThreshold_Lux(I2C_HandleTypeDef I2cHandle,../Inc/MAX44009.h(58): error: &sharp20: identifier 'uint8_t' is undefined uint8_t int_e ,../Inc/MAX44009.h(59): error: &sharp20: identifier 'uint8_t' is undefined uint8_t config ,../Inc/MAX44009.h(60): error: &sharp20: identifier 'uint8_t' is undefined uint8_t thr_upper,../Inc/MAX44009.h(61): error: &sharp20: identifier 'uint8_t' is undefined uint8_t thr_lower,../Inc/MAX44009.h(62): error: &sharp20: identifier 'uint8_t' is undefined uint8_t thr_timer);Instead if I try to include manually on my library stm32l4xx_hal_i2c.h I receive errors on the files of the folder STM32L4XX_HAL_Driver
Could anyone give me some advices of what I'm doing wrong?
#cubemx #i2c #mdk-armv5 #sensor2017-06-16 02:31 AM
Hello,
I have the same error with a simple project from STCubeMX creator !
I tested compilation on Keil MDK-ARM 5.06 and System Workbench for STM32 from AC6 with the same result and error.
My solution is to modify all module header used in your project like this :
Insert the declaration of next typedef :
#ifndef _HAL_StatusTypeDef
#define _HAL_StatusTypeDef typedef enum { HAL_OK = 0x00, HAL_ERROR = 0x01, HAL_BUSY = 0x02, HAL_TIMEOUT = 0x03 } HAL_StatusTypeDef;#endif#ifndef _HAL_LockTypeDef#define _HAL_LockTypeDef typedef enum { HAL_UNLOCKED = 0x00, HAL_LOCKED = 0x01 }HAL_LockTypeDef;#endiflocated in stm32f0xx_hal_def.h file, in all HAL library ModuleName.h file you need in your project.
And don't forget to comment theses typdef in original file stm32f0xx_hal_def.h.
It's work very well for me.
It seems to be an issue in ARM compiler !