therealwokewok / ICM20948

STM32 HAL Driver for ICM20948 IMU
GNU General Public License v3.0
60 stars 21 forks source link

ICM20948.c and ICM20948.h doesn't have two functions #1

Open ghost opened 5 years ago

ghost commented 5 years ago

ICM20948.c and ICM20948.h doesn't have two functions which are used in code example: ICM_ReadAccelGyroData() ICM_ReadMagData(mag_data)

So as a reason of if there are two build errors: /STM32CubeIDE/workspace_1.0.1/SPI_IMU/Debug/../Core/Src/main.c:115: undefined reference to ICM_ReadAccelGyroData' /STM32CubeIDE/workspace_1.0.1/SPI_IMU/Debug/../Core/Src/main.c:119: undefined reference toICM_ReadMagData'

raf329 commented 4 years ago

Hi! In function ICM_readBytes(uint8_t reg, uint8_t *pData, uint16_t Siz) you should add after HAL_SPI_Transmit_DMA(SPI_BUS, &reg, 1); and HAL_SPI_Receive_DMA(SPI_BUS, pData, Size); also this line: while (HAL_SPI_GetState(SPI_BUS) != HAL_SPI_STATE_READY); In my case is it help me)