15#include "common/phal/gpio.h"
16#include "common/phal/spi.h"
18#define BMI088_GYRO_CHIP_ID (0x0FU)
19#define BMI088_ACC_CHIP_ID (0x1EU)
20#define BMI088_ACC_PWR_CTRL_NORMAL (0x04U)
22#define BMI088_GYRO_CHIP_ID_ADDR (0x00U)
23#define BMI088_GYRO_RATE_X_LSB_ADDR (0x02U)
24#define BMI088_GYRO_RATE_Y_LSB_ADDR (0x04U)
25#define BMI088_GYRO_RATE_Z_LSB_ADDR (0x06U)
26#define BMI088_GYRO_RANGE_ADDR (0x0FU)
27#define BMI088_GYRO_BANDWIDTH_ADDR (0x10U)
28#define BMI088_GYRO_SELFTEST_ADDR (0x3CU)
30#define BMI088_ACC_CHIP_ID_ADDR (0x00U)
31#define BMI088_ACC_STATUS_ADDR (0x03U)
32#define BMI088_ACC_RATE_X_LSB_ADDR (0x12U)
33#define BMI088_ACC_RATE_Y_LSB_ADDR (0x14U)
34#define BMI088_ACC_RATE_Z_LSB_ADDR (0x16U)
35#define BMI088_ACC_CONFIG_ADDR (0x40U)
36#define BMI088_ACC_RANGE_ADDR (0x41U)
37#define BMI088_ACC_PWR_CONF_ADDR (0x7CU)
38#define BMI088_ACC_PWR_CTRL_ADDR (0x7DU)
41 ACCEL_ODR_12_5Hz = 0x05,
42 ACCEL_ODR_25Hz = 0x06,
43 ACCEL_ODR_50Hz = 0x07,
44 ACCEL_ODR_100Hz = 0x08,
45 ACCEL_ODR_200Hz = 0x09,
46 ACCEL_ODR_400Hz = 0x0A,
47 ACCEL_ODR_800Hz = 0x0B,
48 ACCEL_ODR_1600Hz = 0x0C,
52 ACCEL_OS_NORMAL = 0x0A,
58 ACCEL_RANGE_3G = 0x00,
59 ACCEL_RANGE_6G = 0x01,
60 ACCEL_RANGE_12G = 0x02,
61 ACCEL_RANGE_24G = 0x03,
65 GYRO_RANGE_2000 = 0x00,
66 GYRO_RANGE_1000 = 0x01,
67 GYRO_RANGE_500 = 0x02,
68 GYRO_RANGE_250 = 0x03,
69 GYRO_RANGE_125 = 0x04,
73 GYRO_DR_2000Hz_532Hz = 0x00,
74 GYRO_DR_2000Hz_230Hz = 0x01,
75 GYRO_DR_1000Hz_116Hz = 0x02,
76 GYRO_DR_400Hz_47Hz = 0x03,
77 GYRO_DR_200Hz_23Hz = 0x04,
78 GYRO_DR_100Hz_12Hz = 0x05,
79 GYRO_DR_200Hz_64Hz = 0x06,
80 GYRO_DR_100Hz_32Hz = 0x07,
97 uint8_t bmi_rx_buffer[16];
98 uint8_t bmi_tx_buffer[16];
101 BMI088_AccelRange_t accel_range;
102 BMI088_AccelBWP_t accel_bwp;
103 BMI088_AccelODR_t accel_odr;
104 BMI088_GyroRange_t gyro_range;
105 BMI088_GyroDrBw_t gyro_datarate;
107 bool enableDynamicRange;
bool BMI088_readGyro(BMI088_Handle_t *bmi)
Blocking function to read the most recent Data Sample from the gyro.
Definition bmi088.c:155
bool BMI088_readAccel(BMI088_Handle_t *bmi)
Blocking function to read the acceleration values form the device.
Definition bmi088.c:190
bool BMI088_gyroOK(BMI088_Handle_t *bmi)
Do self test of gyroscope.
Definition bmi088.c:66
bool BMI088_initAccel(BMI088_Handle_t *bmi)
Setup the accelerometer, must be done 50ms or longer after POR.
Definition bmi088.c:51
bool BMI088_init(BMI088_Handle_t *bmi)
Definition bmi088.c:21
bool BMI088_gyroSelfTestPass(BMI088_Handle_t *bmi)
Check the status of the most recent Gyro self test.
Definition bmi088.c:92
bool BMI088_gyroSelfTestStart(BMI088_Handle_t *bmi)
Start the gyro self test.
Definition bmi088.c:78
bool BMI088_gyroSelfTestComplete(BMI088_Handle_t *bmi)
Check the status of the most recent Gyro self test.
Definition bmi088.c:85
Configuration entry for SPI initilization.
Definition spi.h:26