![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Example
Dependencies: mbed BMI160 max32630fthr
Diff: main.cpp
- Revision:
- 5:4deb38e46a10
- Parent:
- 4:3d7fae7f7b75
- Child:
- 6:1d23dc51ee3f
--- a/main.cpp Tue Dec 20 23:59:35 2016 +0000 +++ b/main.cpp Wed Dec 21 01:03:52 2016 +0000 @@ -55,15 +55,25 @@ i2cBus.frequency(400000); BMI160_I2C imu(i2cBus, BMI160_I2C::I2C_ADRS_SDO_LO); - imu.setSensorPowerMode(BMI160::GYRO, BMI160::NORMAL); - wait_ms(100); - imu.setSensorPowerMode(BMI160::ACC, BMI160::NORMAL); - wait_ms(100); + printf("\033[H"); //home + printf("\033[0J"); //erase from cursor to end of screen uint32_t failures = 0; - printf("\033[H"); //home - printf("\033[0J"); //erase from cursor to end of screen + if(imu.setSensorPowerMode(BMI160::GYRO, BMI160::NORMAL) != BMI160::RTN_NO_ERROR) + { + printf("Failed to set gyroscope power mode\n"); + failures++; + } + wait_ms(100); + + if(imu.setSensorPowerMode(BMI160::ACC, BMI160::NORMAL) != BMI160::RTN_NO_ERROR) + { + printf("Failed to set accelerometer power mode\n"); + failures++; + } + wait_ms(100); + BMI160::AccConfig accConfig; //example of using getSensorConfig