How do I use the STM32CUBEF4 HAL library to read out the sensor data with i2c?
问题 I want to use the latest HAL library instead of Standard Peripheral Library. And i want to readout the BMA250E G-sensor's chip_id, but it doesn't work. Value of aRxBuffer always keep at 0x00. But it should be 0xf9! What's wrong in my code? #include "stm32f4xx_hal.h" #define I2Cx_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() #define I2Cx_SDA_PIN GPIO_PIN_9 #define I2Cx_SDA_GPIO_PORT GPIOB #define I2Cx_SDA_AF GPIO_AF4_I2C1 #define I2Cx_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()