PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <BMI055_accel.hpp>
Public Member Functions | |
BMI055_accel (int bus, const char *path_accel, uint32_t device, enum Rotation rotation) | |
virtual | ~BMI055_accel () |
virtual int | init () |
void | start () |
void | print_info () |
Diagnostics - print some basic information about the driver. More... | |
void | print_registers () |
void | test_error () |
Public Member Functions inherited from BMI055 | |
BMI055 (const char *name, const char *devname, int bus, uint32_t device, enum spi_mode_e mode, uint32_t frequency, enum Rotation rotation) | |
virtual | ~BMI055 ()=default |
Protected Member Functions | |
virtual int | probe () |
Protected Member Functions inherited from BMI055 | |
uint8_t | read_reg (unsigned reg) |
Read a register from the BMI055. More... | |
uint16_t | read_reg16 (unsigned reg) |
void | write_reg (unsigned reg, uint8_t value) |
Write a register in the BMI055. More... | |
BMI055 (const BMI055 &) | |
BMI055 | operator= (const BMI055 &) |
Private Member Functions | |
void | stop () |
Stop automatic measurement. More... | |
int | reset () |
Reset chip. More... | |
void | Run () override |
void | measure () |
Fetch measurements from the sensor and update the report buffers. More... | |
void | modify_reg (unsigned reg, uint8_t clearbits, uint8_t setbits) |
Modify a register in the BMI055_accel. More... | |
void | write_checked_reg (unsigned reg, uint8_t value) |
Write a register in the BMI055_accel, updating _checked_values. More... | |
int | set_accel_range (unsigned max_g) |
Set the BMI055_accel measurement range. More... | |
void | check_registers (void) |
BMI055_accel (const BMI055_accel &) | |
BMI055_accel | operator= (const BMI055_accel &) |
Static Private Attributes | |
static const uint8_t | _checked_registers [BMI055_ACCEL_NUM_CHECKED_REGISTERS] |
Additional Inherited Members | |
Protected Attributes inherited from BMI055 | |
uint8_t | _whoami |
uint8_t | _register_wait |
whoami result More... | |
uint64_t | _reset_wait |
enum Rotation | _rotation |
uint8_t | _checked_next |
Definition at line 142 of file BMI055_accel.hpp.
BMI055_accel::BMI055_accel | ( | int | bus, |
const char * | path_accel, | ||
uint32_t | device, | ||
enum Rotation | rotation | ||
) |
Definition at line 47 of file BMI055_accel.cpp.
References _px4_accel, DRV_ACC_DEVTYPE_BMI055, and PX4Accelerometer::set_device_type().
|
virtual |
Definition at line 60 of file BMI055_accel.cpp.
References _bad_registers, _bad_transfers, _duplicates, _sample_perf, perf_free(), and stop().
|
private |
|
private |
Definition at line 242 of file BMI055_accel.cpp.
References _bad_registers, _checked_bad, BMI055::_checked_next, _checked_registers, _checked_values, BMI055::_register_wait, BMI055::_reset_wait, BMI055_ACC_SOFTRESET, BMI055_ACCEL_NUM_CHECKED_REGISTERS, BMI055_SOFT_RESET, hrt_absolute_time(), perf_count(), BMI055::read_reg(), and BMI055::write_reg().
Referenced by measure().
|
virtual |
Definition at line 73 of file BMI055_accel.cpp.
References DEVICE_DEBUG, ToneAlarmInterface::init(), OK, and reset().
|
private |
Fetch measurements from the sensor and update the report buffers.
Definition at line 285 of file BMI055_accel.cpp.
References _bad_registers, _bad_transfers, _duplicates, _got_duplicate, _px4_accel, BMI055::_register_wait, BMI055::_reset_wait, _sample_perf, BMI055_ACC_X_L, BMI055_NEW_DATA_MASK, check_registers(), DIR_READ, hrt_absolute_time(), hrt_abstime, OK, perf_begin(), perf_count(), perf_end(), perf_event_count(), PX4Accelerometer::set_error_count(), PX4Accelerometer::set_temperature(), and PX4Accelerometer::update().
Referenced by Run().
|
private |
Modify a register in the BMI055_accel.
Bits are cleared before bits are set.
reg | The register to modify. |
clearbits | Bits in the register to clear. |
setbits | Bits in the register to set. |
Definition at line 155 of file BMI055_accel.cpp.
References BMI055::read_reg(), and write_checked_reg().
Referenced by set_accel_range().
|
private |
void BMI055_accel::print_info | ( | ) |
Diagnostics - print some basic information about the driver.
Definition at line 405 of file BMI055_accel.cpp.
References _bad_registers, _bad_transfers, _checked_bad, BMI055::_checked_next, _checked_registers, _checked_values, _duplicates, _px4_accel, _sample_perf, BMI055_ACCEL_NUM_CHECKED_REGISTERS, perf_print_counter(), PX4Accelerometer::print_status(), and BMI055::read_reg().
void BMI055_accel::print_registers | ( | ) |
Definition at line 436 of file BMI055_accel.cpp.
References _checked_registers, and BMI055::read_reg().
Referenced by test_error().
|
protectedvirtual |
Definition at line 124 of file BMI055_accel.cpp.
References _checked_bad, _checked_values, BMI055::_whoami, BMI055_ACC_CHIP_ID, BMI055_ACC_WHO_AM_I, DEVICE_DEBUG, OK, and BMI055::read_reg().
|
private |
Reset chip.
Resets the chip and measurements ranges, but not scale and offset.
Definition at line 87 of file BMI055_accel.cpp.
References _checked_registers, _checked_values, BMI055_ACC_BW, BMI055_ACC_DRDY_INT1, BMI055_ACC_DRDY_INT_EN, BMI055_ACC_INT_EN_1, BMI055_ACC_INT_MAP_1, BMI055_ACC_PMU_LPW, BMI055_ACC_RANGE, BMI055_ACC_SOFTRESET, BMI055_ACCEL_BW_500, BMI055_ACCEL_DEFAULT_RANGE_G, BMI055_ACCEL_NORMAL, BMI055_ACCEL_NUM_CHECKED_REGISTERS, BMI055_ACCEL_RANGE_2_G, BMI055_SOFT_RESET, OK, BMI055::read_reg(), set_accel_range(), write_checked_reg(), and BMI055::write_reg().
Referenced by init().
|
overrideprivate |
Definition at line 235 of file BMI055_accel.cpp.
References measure().
|
private |
Set the BMI055_accel measurement range.
max_g | The maximum G value the range must support. |
Definition at line 177 of file BMI055_accel.cpp.
References _px4_accel, BMI055_ACC_RANGE, BMI055_ACCEL_RANGE_16_G, BMI055_ACCEL_RANGE_2_G, BMI055_ACCEL_RANGE_4_G, BMI055_ACCEL_RANGE_8_G, CONSTANTS_ONE_G, modify_reg(), OK, and PX4Accelerometer::set_scale().
Referenced by reset().
void BMI055_accel::start | ( | ) |
Definition at line 219 of file BMI055_accel.cpp.
References BMI055_ACCEL_DEFAULT_RATE, BMI055_TIMER_REDUCTION, and stop().
|
private |
Stop automatic measurement.
Definition at line 229 of file BMI055_accel.cpp.
Referenced by start(), and ~BMI055_accel().
void BMI055_accel::test_error | ( | ) |
Definition at line 147 of file BMI055_accel.cpp.
References BMI055_ACC_SOFTRESET, BMI055_SOFT_RESET, print_registers(), and BMI055::write_reg().
|
private |
Write a register in the BMI055_accel, updating _checked_values.
reg | The register to write. |
value | The new value to write. |
Definition at line 164 of file BMI055_accel.cpp.
References _checked_bad, _checked_registers, _checked_values, BMI055_ACCEL_NUM_CHECKED_REGISTERS, and BMI055::write_reg().
Referenced by modify_reg(), and reset().
|
private |
Definition at line 173 of file BMI055_accel.hpp.
Referenced by check_registers(), measure(), print_info(), and ~BMI055_accel().
|
private |
Definition at line 172 of file BMI055_accel.hpp.
Referenced by measure(), print_info(), and ~BMI055_accel().
|
private |
Definition at line 182 of file BMI055_accel.hpp.
Referenced by check_registers(), print_info(), probe(), and write_checked_reg().
|
staticprivate |
Definition at line 180 of file BMI055_accel.hpp.
Referenced by check_registers(), print_info(), print_registers(), reset(), and write_checked_reg().
|
private |
Definition at line 181 of file BMI055_accel.hpp.
Referenced by check_registers(), print_info(), probe(), reset(), and write_checked_reg().
|
private |
Definition at line 174 of file BMI055_accel.hpp.
Referenced by measure(), print_info(), and ~BMI055_accel().
|
private |
Definition at line 184 of file BMI055_accel.hpp.
Referenced by measure().
|
private |
Definition at line 169 of file BMI055_accel.hpp.
Referenced by BMI055_accel(), measure(), print_info(), and set_accel_range().
|
private |
Definition at line 171 of file BMI055_accel.hpp.
Referenced by measure(), print_info(), and ~BMI055_accel().