Implemented first Hangar-Service

Dependencies:   CalibrateMagneto QuaternionMath

Fork of SML2 by TobyRich GmbH

Gyroscope.cpp

Committer:
pvaibhav
Date:
2015-01-23
Revision:
4:e759b8c756da
Child:
5:b9f2f62a8f90

File content as of revision 4:e759b8c756da:

#include "Gyroscope.h"
#define DEBUG "BMX055-Gyr"
#include "Logger.h"

Gyroscope::Gyroscope(I2C &i2c) : I2CPeripheral(i2c, 0x69 << 1 /* address */) {
    write_reg(0x14, 0xB6); // reset
    wait_ms(30); // page 14
    
    const uint8_t chip_id = read_reg(0x00);
    if (chip_id == 0x0f) {
        INFO("Bosch Sensortec BMX055-Gyro ready");
    } else {
        WARN("Bosch Sensortec BMX055-Gyro not found (chip ID=0x%02x, expected=0x0f)", chip_id);
    }
}