Implemented first Hangar-Service

Dependencies:   CalibrateMagneto QuaternionMath

Fork of SML2 by TobyRich GmbH

Barometer.cpp

Committer:
pvaibhav
Date:
2015-01-14
Revision:
1:c279bc3af90c
Child:
2:3898208e02da

File content as of revision 1:c279bc3af90c:

#include "Barometer.h"
#define DEBUG "BMP280"
#include "Logger.h"

Barometer::Barometer(I2C &i2c) : I2CPeripheral(i2c, 0xEC /* address */) {
    write_reg(0xE0, 0xB6); // reset
    wait_ms(2); // cf. datasheet page 8, t_startup
    const uint8_t chip_id = read_reg(0xD0);
    if (chip_id == 0x58) {
        INFO("Bosch Sensortec BMP280 ready");
    } else {
        WARN("Bosch Sensortec BMP280 not found (chip ID=0x%02x, expected=0x58)", chip_id);
    }
}

float Barometer::getPressure() {
    
}