PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <BMI088_accel.hpp>
Public Member Functions | |
BMI088_accel (int bus, const char *path_accel, uint32_t device, enum Rotation rotation) | |
virtual | ~BMI088_accel () |
virtual int | init () |
void | start () |
virtual uint8_t | read_reg (unsigned reg) |
Read a register from the BMI088. More... | |
virtual uint16_t | read_reg16 (unsigned reg) |
void | print_info () |
Diagnostics - print some basic information about the driver. More... | |
void | print_registers () |
void | test_error () |
Public Member Functions inherited from BMI088 | |
BMI088 (const char *name, const char *devname, int bus, uint32_t device, enum spi_mode_e mode, uint32_t frequency, enum Rotation rotation) | |
virtual | ~BMI088 ()=default |
Protected Member Functions | |
virtual int | probe () |
Protected Member Functions inherited from BMI088 | |
void | write_reg (unsigned reg, uint8_t value) |
Write a register in the BMI088. More... | |
BMI088 (const BMI088 &) | |
BMI088 | operator= (const BMI088 &) |
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 BMI088_accel. More... | |
void | write_checked_reg (unsigned reg, uint8_t value) |
Write a register in the BMI088_accel, updating _checked_values. More... | |
int | set_accel_range (unsigned max_g) |
Set the BMI088_accel measurement range. More... | |
int | accel_set_sample_rate (float desired_sample_rate_hz) |
Set accel sample rate. More... | |
void | check_registers (void) |
BMI088_accel (const BMI088_accel &) | |
BMI088_accel | operator= (const BMI088_accel &) |
Static Private Attributes | |
static const uint8_t | _checked_registers [BMI088_ACCEL_NUM_CHECKED_REGISTERS] |
Additional Inherited Members | |
Protected Attributes inherited from BMI088 | |
uint8_t | _whoami |
uint8_t | _register_wait |
whoami result More... | |
uint64_t | _reset_wait |
enum Rotation | _rotation |
uint8_t | _checked_next |
Definition at line 157 of file BMI088_accel.hpp.
BMI088_accel::BMI088_accel | ( | int | bus, |
const char * | path_accel, | ||
uint32_t | device, | ||
enum Rotation | rotation | ||
) |
Definition at line 55 of file BMI088_accel.cpp.
References _px4_accel, DRV_DEVTYPE_BMI088, and PX4Accelerometer::set_device_type().
|
virtual |
Definition at line 68 of file BMI088_accel.cpp.
References _bad_registers, _bad_transfers, _duplicates, _sample_perf, perf_free(), and stop().
|
private |
|
private |
Set accel sample rate.
Definition at line 203 of file BMI088_accel.cpp.
References BMI088_ACC_CONF, BMI088_ACC_CONF_ODR_100, BMI088_ACC_CONF_ODR_12_5, BMI088_ACC_CONF_ODR_1600, BMI088_ACC_CONF_ODR_200, BMI088_ACC_CONF_ODR_25, BMI088_ACC_CONF_ODR_400, BMI088_ACC_CONF_ODR_50, BMI088_ACC_CONF_ODR_800, modify_reg(), and OK.
Referenced by reset().
|
private |
Definition at line 354 of file BMI088_accel.cpp.
References _bad_registers, _checked_bad, BMI088::_checked_next, _checked_registers, _checked_values, BMI088::_register_wait, BMI088::_reset_wait, BMI088_ACC_SOFTRESET, BMI088_ACCEL_NUM_CHECKED_REGISTERS, BMI088_SOFT_RESET, hrt_absolute_time(), perf_count(), read_reg(), and BMI088::write_reg().
Referenced by measure().
|
virtual |
Definition at line 81 of file BMI088_accel.cpp.
References DEVICE_DEBUG, ToneAlarmInterface::init(), OK, and reset().
|
private |
Fetch measurements from the sensor and update the report buffers.
Definition at line 397 of file BMI088_accel.cpp.
References _accel_last_temperature_copy, _bad_registers, _bad_transfers, _duplicates, _got_duplicate, _px4_accel, BMI088::_register_wait, BMI088::_reset_wait, _sample_perf, BMI088_ACC_STATUS, BMI088_ACC_STATUS_DRDY, BMI088_ACC_TEMP_H, BMI088_ACC_X_L, check_registers(), DIR_READ, f(), hrt_absolute_time(), hrt_abstime, OK, perf_begin(), perf_count(), perf_end(), perf_event_count(), read_reg(), PX4Accelerometer::set_error_count(), PX4Accelerometer::set_temperature(), status, and PX4Accelerometer::update().
Referenced by Run().
|
private |
Modify a register in the BMI088_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 263 of file BMI088_accel.cpp.
References read_reg(), and write_checked_reg().
Referenced by accel_set_sample_rate(), and set_accel_range().
|
private |
void BMI088_accel::print_info | ( | ) |
Diagnostics - print some basic information about the driver.
Definition at line 533 of file BMI088_accel.cpp.
References _bad_registers, _bad_transfers, _checked_bad, BMI088::_checked_next, _checked_registers, _checked_values, _duplicates, _px4_accel, _sample_perf, BMI088_ACCEL_NUM_CHECKED_REGISTERS, perf_print_counter(), PX4Accelerometer::print_status(), and read_reg().
void BMI088_accel::print_registers | ( | ) |
Definition at line 566 of file BMI088_accel.cpp.
References _checked_registers, and read_reg().
Referenced by test_error().
|
protectedvirtual |
Definition at line 178 of file BMI088_accel.cpp.
References _checked_bad, _checked_values, BMI088::_whoami, BMI088_ACC_CHIP_ID, BMI088_ACC_WHO_AM_I, DEVICE_DEBUG, OK, and read_reg().
|
virtual |
Read a register from the BMI088.
The | register to read. |
Reimplemented from BMI088.
Definition at line 96 of file BMI088_accel.cpp.
References DIR_READ.
Referenced by check_registers(), measure(), modify_reg(), print_info(), print_registers(), probe(), and reset().
|
virtual |
|
private |
Reset chip.
Resets the chip and measurements ranges, but not scale and offset.
Definition at line 117 of file BMI088_accel.cpp.
References _checked_registers, _checked_values, accel_set_sample_rate(), BMI088_ACC_CHIP_ID, BMI088_ACC_INT1_INT2_MAP_DATA, BMI088_ACC_INT1_INT2_MAP_DATA_INT1_DRDY, BMI088_ACC_INT1_IO_CONF, BMI088_ACC_INT1_IO_CONF_ACTIVE_HIGH, BMI088_ACC_INT1_IO_CONF_INT1_OUT, BMI088_ACC_INT1_IO_CONF_PP, BMI088_ACC_PWR_CONF, BMI088_ACC_PWR_CONF_ACTIVE, BMI088_ACC_PWR_CTRL, BMI088_ACC_PWR_CTRL_EN, BMI088_ACC_SOFTRESET, BMI088_ACCEL_DEFAULT_RANGE_G, BMI088_ACCEL_DEFAULT_RATE, BMI088_ACCEL_NUM_CHECKED_REGISTERS, BMI088_SOFT_RESET, OK, read_reg(), set_accel_range(), write_checked_reg(), and BMI088::write_reg().
Referenced by init(), and start().
|
overrideprivate |
Definition at line 347 of file BMI088_accel.cpp.
References measure().
|
private |
Set the BMI088_accel measurement range.
max_g | The maximum G value the range must support. |
Definition at line 285 of file BMI088_accel.cpp.
References _px4_accel, BMI088_ACC_RANGE, BMI088_ACCEL_RANGE_12_G, BMI088_ACCEL_RANGE_24_G, BMI088_ACCEL_RANGE_3_G, BMI088_ACCEL_RANGE_6_G, CONSTANTS_ONE_G, modify_reg(), OK, and PX4Accelerometer::set_scale().
Referenced by reset().
void BMI088_accel::start | ( | ) |
Definition at line 327 of file BMI088_accel.cpp.
References BMI088_ACCEL_DEFAULT_RATE, BMI088_TIMER_REDUCTION, reset(), and stop().
|
private |
Stop automatic measurement.
Definition at line 341 of file BMI088_accel.cpp.
Referenced by start(), and ~BMI088_accel().
void BMI088_accel::test_error | ( | ) |
Definition at line 255 of file BMI088_accel.cpp.
References BMI088_ACC_SOFTRESET, BMI088_SOFT_RESET, print_registers(), and BMI088::write_reg().
|
private |
Write a register in the BMI088_accel, updating _checked_values.
reg | The register to write. |
value | The new value to write. |
Definition at line 272 of file BMI088_accel.cpp.
References _checked_bad, _checked_registers, _checked_values, BMI088_ACCEL_NUM_CHECKED_REGISTERS, and BMI088::write_reg().
Referenced by modify_reg(), and reset().
|
private |
Definition at line 194 of file BMI088_accel.hpp.
Referenced by check_registers(), measure(), print_info(), and ~BMI088_accel().
|
private |
Definition at line 193 of file BMI088_accel.hpp.
Referenced by measure(), print_info(), and ~BMI088_accel().
|
private |
Definition at line 203 of file BMI088_accel.hpp.
Referenced by check_registers(), print_info(), probe(), and write_checked_reg().
|
staticprivate |
Definition at line 201 of file BMI088_accel.hpp.
Referenced by check_registers(), print_info(), print_registers(), reset(), and write_checked_reg().
|
private |
Definition at line 202 of file BMI088_accel.hpp.
Referenced by check_registers(), print_info(), probe(), reset(), and write_checked_reg().
|
private |
Definition at line 195 of file BMI088_accel.hpp.
Referenced by measure(), print_info(), and ~BMI088_accel().
|
private |
Definition at line 205 of file BMI088_accel.hpp.
Referenced by measure().
|
private |
Definition at line 190 of file BMI088_accel.hpp.
Referenced by BMI088_accel(), measure(), print_info(), and set_accel_range().
|
private |
Definition at line 192 of file BMI088_accel.hpp.
Referenced by measure(), print_info(), and ~BMI088_accel().