AHRS
Dependencies: Eigen
Diff: BMI088.cpp
- Revision:
- 29:cd963a6d31c5
- Parent:
- 28:21dfb161c67c
--- a/BMI088.cpp Mon Jan 20 12:41:13 2020 +0000 +++ b/BMI088.cpp Mon Jan 27 09:23:58 2020 +0000 @@ -12,13 +12,14 @@ { setAccScaleRange(RANGE_3G); wait(.02); - setAccOutputDataRate(ODR_100); // ODR_100 -> 40 Hz bandwith in normal mode + setAccOutputDataRate(ODR_50); // ODR_50 -> 20 Hz bandwith in normal mode + // setAccOutputDataRateOSR2(ODR_100); // ODR_100 -> 19 Hz bandwith in OSR2 mode wait(.02); setAccPowerMode(ACC_ACTIVE); wait(.02); setGyroScaleRange(RANGE_500); wait(.02); - setGyroOutputDataRate(ODR_400_BW_47); + setGyroOutputDataRate(ODR_200_BW_23); wait(.02); setGyroPowerMode(GYRO_NORMAL); } @@ -82,13 +83,30 @@ void BMI088::setAccOutputDataRate(acc_odr_type_t odr) { + /* uint8_t data = 0; data = read8(ACC, BMI088_ACC_CONF); - data = data & 0xf0; + data = data & 0xf0; // 0xf0 := 11110000 data = data | (uint8_t)odr; write8(ACC, BMI088_ACC_CONF, data); + */ + + uint8_t data = (uint8_t)0xa0 | (uint8_t)odr; + write8(ACC, BMI088_ACC_CONF, data); +} + +void BMI088::setAccOutputDataRateOSR2(acc_odr_type_t odr) +{ + uint8_t data = (uint8_t)0x90 | (uint8_t)odr; + write8(ACC, BMI088_ACC_CONF, data); +} + +void BMI088::setAccOutputDataRateOSR4(acc_odr_type_t odr) +{ + uint8_t data = (uint8_t)0x80 | (uint8_t)odr; + write8(ACC, BMI088_ACC_CONF, data); } void BMI088::setGyroScaleRange(gyro_scale_type_t range)