Driver the the BMA180 accelerometer. More...
#include <bma180.hpp>
Public Member Functions | |
BMA180 (bosch_hardware_interface *hw) | |
bool | Calibrate () |
bool | changeAccelRange () |
bool | changeBandwidth () |
bool | CoarseCalibrate () |
bool | DisableI2C () |
bool | EnableWriting () |
bool | FullCalibration () |
bool | getAccelData () |
double | getAccelX () |
double | getAccelY () |
double | getAccelZ () |
uint8_t | getDeviceAddress () |
double | getStaticPitch () |
double | getStaticRoll () |
double | getTemperature () |
bool | initialize () |
bool | setEnOffsetBit (uint8_t bit) |
bool | softReset () |
bool | takeMeasurement () |
bool | TwoStepCoarseCalibrate () |
~BMA180 () | |
Public Attributes | |
double | AccelX_ |
double | AccelY_ |
double | AccelZ_ |
double | StaticPitch_ |
double | StaticRoll_ |
double | Temperature_ |
double | TempSlope_ |
Protected Member Functions | |
bool | readReg (uint8_t reg, uint8_t *value) |
bool | readSensorData (uint8_t reg, uint8_t *value, uint8_t num_bytes) |
bool | writeToReg (uint8_t reg, uint8_t value) |
bool | writeToRegAndVerify (uint8_t reg, uint8_t value, uint8_t expected_value) |
Static Protected Attributes | |
static const uint8_t | ADDRESS_ACCLX_MSB = 0x03 |
static const uint8_t | ADDRESS_ACCLXYZ = 0x02 |
static const uint8_t | ADDRESS_ACCLY_LSB = 0x04 |
static const uint8_t | ADDRESS_ACCLY_MSB = 0x05 |
static const uint8_t | ADDRESS_ACCLZ_LSB = 0x06 |
static const uint8_t | ADDRESS_ACCLZ_MSB = 0x07 |
static const uint8_t | ADDRESS_BW_TCS = 0x20 |
INTEGRATED DIGITAL FILTER: | |
static const uint8_t | ADDRESS_CD1 = 0x2C |
static const uint8_t | ADDRESS_CD2 = 0x2D |
static const uint8_t | ADDRESS_CTRL_REG4 = 0x22 |
static const uint8_t | ADDRESS_CTRLREG0 = 0x0D |
static const uint8_t | ADDRESS_CTRLREG1 = 0x0E |
static const uint8_t | ADDRESS_CTRLREG2 = 0x0F |
static const uint8_t | ADDRESS_EE_CD1 = 0x4C |
static const uint8_t | ADDRESS_EE_CD2 = 0x4D |
static const uint8_t | ADDRESS_EE_GAIN_T = 0x51 |
static const uint8_t | ADDRESS_EE_GAIN_X = 0x52 |
static const uint8_t | ADDRESS_EE_GAIN_Y = 0x53 |
static const uint8_t | ADDRESS_EE_GAIN_Z = 0x54 |
static const uint8_t | ADDRESS_EE_OFFSET_LSB1 = 0x55 |
static const uint8_t | ADDRESS_EE_OFFSET_LSB2 = 0x56 |
static const uint8_t | ADDRESS_EE_OFFSET_T = 0x57 |
static const uint8_t | ADDRESS_EE_OFFSET_X = 0x58 |
static const uint8_t | ADDRESS_EE_OFFSET_Y = 0x59 |
static const uint8_t | ADDRESS_EE_OFFSET_Z = 0x5A |
Calibration addresses in the EEPROM. | |
static const uint8_t | ADDRESS_GAIN_T = 0x31 |
static const uint8_t | ADDRESS_GAIN_X = 0x32 |
static const uint8_t | ADDRESS_GAIN_Y = 0x33 |
static const uint8_t | ADDRESS_GAIN_Z = 0x34 |
static const uint8_t | ADDRESS_HIGH_DUR = 0x27 |
Disable-I2C. | |
static const uint8_t | ADDRESS_OFFSET_LSB1 = 0x35 |
static const uint8_t | ADDRESS_OFFSET_LSB2 = 0x36 |
static const uint8_t | ADDRESS_OFFSET_T = 0x37 |
static const uint8_t | ADDRESS_OFFSET_X = 0x38 |
static const uint8_t | ADDRESS_OFFSET_Y = 0x39 |
static const uint8_t | ADDRESS_OFFSET_Z = 0x3A |
Calibration addresses NOT in EEPROM. Deleted every power cycle. | |
static const uint8_t | ADDRESS_SOFTRESET = 0x10 |
Soft-Reset. | |
static const uint8_t | ADDRESS_STATUS_REG1 = 0x09 |
static const uint8_t | ADDRESS_STATUS_REG2 = 0x0A |
static const uint8_t | ADDRESS_STATUS_REG3 = 0x0B |
static const uint8_t | ADDRESS_STATUS_REG4 = 0x0C |
static const uint8_t | ADDRESS_TEMPERATURE = 0x08 |
static const uint8_t | ADDRESS_VER = 0x00 |
static const uint8_t | bw = 4 |
static const uint8_t | CMD_DISABLE_I2C = 0x01 |
static const uint8_t | CMD_SOFTRESET = 0xB6 |
static const uint8_t | ee_w = 4 |
(relevant) BITFLAGS for changing settings: | |
static const uint8_t | en_offset_x = 7 |
static const uint8_t | en_offset_y = 6 |
static const uint8_t | en_offset_z = 5 |
static const uint8_t | offset_finetuning = 0 |
static const uint8_t | offset_st_s = 1 |
static const uint8_t | range = 1 |
static const uint8_t | SLAVE_ADDRESS0 = 0x40 |
static const uint8_t | SLAVE_ADDRESS1 = 0x41 |
Driver the the BMA180 accelerometer.
This class provides access to both the acceleration and temperature data. Users can change the sensor's basic settings, such as bandwidth and range; however, the user cannot change modes and cannot directly implement the sensor's built-in slope-detection routines.
Definition at line 71 of file bma180.hpp.
Definition at line 63 of file bma180.cpp.
BMA180::~BMA180 | ( | ) |
Definition at line 75 of file bma180.cpp.
bool BMA180::Calibrate | ( | ) |
Definition at line 321 of file bma180.cpp.
bool BMA180::changeAccelRange | ( | ) |
Definition at line 1049 of file bma180.cpp.
bool BMA180::changeBandwidth | ( | ) |
Definition at line 1103 of file bma180.cpp.
bool BMA180::CoarseCalibrate | ( | ) |
Definition at line 449 of file bma180.cpp.
bool BMA180::DisableI2C | ( | ) |
Definition at line 971 of file bma180.cpp.
bool BMA180::EnableWriting | ( | ) |
Definition at line 995 of file bma180.cpp.
bool BMA180::FullCalibration | ( | ) |
Definition at line 771 of file bma180.cpp.
bool BMA180::getAccelData | ( | ) |
Definition at line 204 of file bma180.cpp.
double BMA180::getAccelX | ( | ) |
Definition at line 222 of file bma180.cpp.
double BMA180::getAccelY | ( | ) |
Definition at line 243 of file bma180.cpp.
double BMA180::getAccelZ | ( | ) |
Definition at line 262 of file bma180.cpp.
uint8_t BMA180::getDeviceAddress | ( | ) | [virtual] |
Implements bosch_drivers_common::sensor_driver.
Definition at line 82 of file bma180.cpp.
double BMA180::getStaticPitch | ( | ) |
Definition at line 184 of file bma180.cpp.
double BMA180::getStaticRoll | ( | ) |
Definition at line 194 of file bma180.cpp.
double BMA180::getTemperature | ( | ) |
Definition at line 281 of file bma180.cpp.
bool BMA180::initialize | ( | ) |
Definition at line 111 of file bma180.cpp.
bool BMA180::readReg | ( | uint8_t | reg, |
uint8_t * | value | ||
) | [protected] |
Definition at line 1210 of file bma180.cpp.
bool BMA180::readSensorData | ( | uint8_t | reg, |
uint8_t * | value, | ||
uint8_t | num_bytes | ||
) | [protected] |
Definition at line 1293 of file bma180.cpp.
bool BMA180::setEnOffsetBit | ( | uint8_t | bit | ) |
Definition at line 1156 of file bma180.cpp.
bool BMA180::softReset | ( | ) |
Definition at line 299 of file bma180.cpp.
bool BMA180::takeMeasurement | ( | ) |
Definition at line 165 of file bma180.cpp.
bool BMA180::TwoStepCoarseCalibrate | ( | ) |
Definition at line 623 of file bma180.cpp.
bool BMA180::writeToReg | ( | uint8_t | reg, |
uint8_t | value | ||
) | [protected] |
Definition at line 1241 of file bma180.cpp.
bool BMA180::writeToRegAndVerify | ( | uint8_t | reg, |
uint8_t | value, | ||
uint8_t | expected_value | ||
) | [protected] |
Definition at line 1272 of file bma180.cpp.
double BMA180::AccelX_ |
Definition at line 125 of file bma180.hpp.
double BMA180::AccelY_ |
Definition at line 126 of file bma180.hpp.
double BMA180::AccelZ_ |
Definition at line 127 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_ACCLX_MSB = 0x03 [static, protected] |
Definition at line 152 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_ACCLXYZ = 0x02 [static, protected] |
Definition at line 151 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_ACCLY_LSB = 0x04 [static, protected] |
Definition at line 153 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_ACCLY_MSB = 0x05 [static, protected] |
Definition at line 154 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_ACCLZ_LSB = 0x06 [static, protected] |
Definition at line 155 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_ACCLZ_MSB = 0x07 [static, protected] |
Definition at line 156 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_BW_TCS = 0x20 [static, protected] |
INTEGRATED DIGITAL FILTER:
Definition at line 200 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_CD1 = 0x2C [static, protected] |
Definition at line 162 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_CD2 = 0x2D [static, protected] |
Definition at line 163 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_CTRL_REG4 = 0x22 [static, protected] |
Definition at line 173 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_CTRLREG0 = 0x0D [static, protected] |
Definition at line 170 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_CTRLREG1 = 0x0E [static, protected] |
Definition at line 171 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_CTRLREG2 = 0x0F [static, protected] |
Definition at line 172 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_CD1 = 0x4C [static, protected] |
Definition at line 160 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_CD2 = 0x4D [static, protected] |
Definition at line 161 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_GAIN_T = 0x51 [static, protected] |
Definition at line 185 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_GAIN_X = 0x52 [static, protected] |
Definition at line 184 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_GAIN_Y = 0x53 [static, protected] |
Definition at line 183 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_GAIN_Z = 0x54 [static, protected] |
Definition at line 182 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_OFFSET_LSB1 = 0x55 [static, protected] |
Definition at line 181 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_OFFSET_LSB2 = 0x56 [static, protected] |
Definition at line 180 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_OFFSET_T = 0x57 [static, protected] |
Definition at line 179 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_OFFSET_X = 0x58 [static, protected] |
Definition at line 178 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_OFFSET_Y = 0x59 [static, protected] |
Definition at line 177 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_EE_OFFSET_Z = 0x5A [static, protected] |
Calibration addresses in the EEPROM.
Definition at line 176 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_GAIN_T = 0x31 [static, protected] |
Definition at line 197 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_GAIN_X = 0x32 [static, protected] |
Definition at line 196 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_GAIN_Y = 0x33 [static, protected] |
Definition at line 195 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_GAIN_Z = 0x34 [static, protected] |
Definition at line 194 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_HIGH_DUR = 0x27 [static, protected] |
Disable-I2C.
Definition at line 207 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_OFFSET_LSB1 = 0x35 [static, protected] |
Definition at line 193 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_OFFSET_LSB2 = 0x36 [static, protected] |
Definition at line 192 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_OFFSET_T = 0x37 [static, protected] |
Definition at line 191 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_OFFSET_X = 0x38 [static, protected] |
Definition at line 190 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_OFFSET_Y = 0x39 [static, protected] |
Definition at line 189 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_OFFSET_Z = 0x3A [static, protected] |
Calibration addresses NOT in EEPROM. Deleted every power cycle.
Definition at line 188 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_SOFTRESET = 0x10 [static, protected] |
Soft-Reset.
Definition at line 203 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_STATUS_REG1 = 0x09 [static, protected] |
Definition at line 166 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_STATUS_REG2 = 0x0A [static, protected] |
Definition at line 167 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_STATUS_REG3 = 0x0B [static, protected] |
Definition at line 168 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_STATUS_REG4 = 0x0C [static, protected] |
Definition at line 169 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_TEMPERATURE = 0x08 [static, protected] |
Definition at line 157 of file bma180.hpp.
const uint8_t BMA180::ADDRESS_VER = 0x00 [static, protected] |
Definition at line 165 of file bma180.hpp.
const uint8_t BMA180::bw = 4 [static, protected] |
Definition at line 222 of file bma180.hpp.
const uint8_t BMA180::CMD_DISABLE_I2C = 0x01 [static, protected] |
Definition at line 208 of file bma180.hpp.
const uint8_t BMA180::CMD_SOFTRESET = 0xB6 [static, protected] |
Definition at line 204 of file bma180.hpp.
const uint8_t BMA180::ee_w = 4 [static, protected] |
(relevant) BITFLAGS for changing settings:
Definition at line 214 of file bma180.hpp.
const uint8_t BMA180::en_offset_x = 7 [static, protected] |
Definition at line 226 of file bma180.hpp.
const uint8_t BMA180::en_offset_y = 6 [static, protected] |
Definition at line 227 of file bma180.hpp.
const uint8_t BMA180::en_offset_z = 5 [static, protected] |
Definition at line 228 of file bma180.hpp.
const uint8_t BMA180::offset_finetuning = 0 [static, protected] |
Definition at line 236 of file bma180.hpp.
const uint8_t BMA180::offset_st_s = 1 [static, protected] |
Definition at line 232 of file bma180.hpp.
const uint8_t BMA180::range = 1 [static, protected] |
Definition at line 218 of file bma180.hpp.
const uint8_t BMA180::SLAVE_ADDRESS0 = 0x40 [static, protected] |
Definition at line 142 of file bma180.hpp.
const uint8_t BMA180::SLAVE_ADDRESS1 = 0x41 [static, protected] |
Definition at line 148 of file bma180.hpp.
double BMA180::StaticPitch_ |
Definition at line 129 of file bma180.hpp.
double BMA180::StaticRoll_ |
Definition at line 130 of file bma180.hpp.
double BMA180::Temperature_ |
Definition at line 128 of file bma180.hpp.
double BMA180::TempSlope_ |
Definition at line 132 of file bma180.hpp.