PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <BMI055_gyro.hpp>
Classes | |
struct | BMI_GyroReport |
Report conversation within the BMI055_gyro, including command byte and interrupt status. More... | |
Public Member Functions | |
BMI055_gyro (int bus, const char *path_gyro, uint32_t device, enum Rotation rotation) | |
virtual | ~BMI055_gyro () |
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_gyro. More... | |
void | write_checked_reg (unsigned reg, uint8_t value) |
Write a register in the BMI055_gyro, updating _checked_values. More... | |
int | set_gyro_range (unsigned max_dps) |
Set the BMI055_gyro measurement range. More... | |
int | gyro_set_sample_rate (float desired_sample_rate_hz) |
void | check_registers (void) |
BMI055_gyro (const BMI055_gyro &) | |
BMI055_gyro | operator= (const BMI055_gyro &) |
Private Attributes | |
PX4Gyroscope | _px4_gyro |
perf_counter_t | _sample_perf |
perf_counter_t | _bad_transfers |
perf_counter_t | _bad_registers |
uint8_t | _checked_values [BMI055_GYRO_NUM_CHECKED_REGISTERS] |
uint8_t | _checked_bad [BMI055_GYRO_NUM_CHECKED_REGISTERS] |
Static Private Attributes | |
static const uint8_t | _checked_registers [BMI055_GYRO_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 134 of file BMI055_gyro.hpp.
BMI055_gyro::BMI055_gyro | ( | int | bus, |
const char * | path_gyro, | ||
uint32_t | device, | ||
enum Rotation | rotation | ||
) |
Definition at line 50 of file BMI055_gyro.cpp.
References _px4_gyro, DRV_GYR_DEVTYPE_BMI055, and PX4Gyroscope::set_device_type().
|
virtual |
Definition at line 61 of file BMI055_gyro.cpp.
References _bad_registers, _bad_transfers, _sample_perf, perf_free(), and stop().
|
private |
|
private |
Definition at line 278 of file BMI055_gyro.cpp.
References _bad_registers, _checked_bad, BMI055::_checked_next, _checked_registers, _checked_values, BMI055::_register_wait, BMI055::_reset_wait, BMI055_GYR_SOFTRESET, BMI055_GYRO_NUM_CHECKED_REGISTERS, BMI055_SOFT_RESET, hrt_absolute_time(), perf_count(), BMI055::read_reg(), and BMI055::write_reg().
Referenced by measure().
|
private |
Definition at line 144 of file BMI055_gyro.cpp.
References BMI055_GYR_BW, BMI055_GYRO_BW_MASK, BMI055_GYRO_RATE_100, BMI055_GYRO_RATE_1000, BMI055_GYRO_RATE_2000, BMI055_GYRO_RATE_400, modify_reg(), and OK.
Referenced by reset().
|
virtual |
Definition at line 73 of file BMI055_gyro.cpp.
References DEVICE_DEBUG, ToneAlarmInterface::init(), OK, and reset().
|
private |
Fetch measurements from the sensor and update the report buffers.
Definition at line 321 of file BMI055_gyro.cpp.
References _bad_registers, _bad_transfers, _px4_gyro, BMI055::_register_wait, BMI055::_reset_wait, _sample_perf, BMI055_ACC_TEMP, BMI055_GYR_X_L, check_registers(), BMI055_gyro::BMI_GyroReport::cmd, DIR_READ, hrt_absolute_time(), hrt_abstime, OK, perf_begin(), perf_count(), perf_end(), perf_event_count(), BMI055::read_reg(), PX4Gyroscope::set_error_count(), PX4Gyroscope::set_temperature(), and PX4Gyroscope::update().
Referenced by Run().
|
private |
Modify a register in the BMI055_gyro.
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 186 of file BMI055_gyro.cpp.
References BMI055::read_reg(), and write_checked_reg().
Referenced by gyro_set_sample_rate(), and set_gyro_range().
|
private |
void BMI055_gyro::print_info | ( | ) |
Diagnostics - print some basic information about the driver.
Definition at line 415 of file BMI055_gyro.cpp.
References _bad_registers, _bad_transfers, _checked_bad, BMI055::_checked_next, _checked_registers, _checked_values, _px4_gyro, _sample_perf, BMI055_GYRO_NUM_CHECKED_REGISTERS, perf_print_counter(), PX4Gyroscope::print_status(), and BMI055::read_reg().
void BMI055_gyro::print_registers | ( | ) |
Definition at line 447 of file BMI055_gyro.cpp.
References _checked_registers, and BMI055::read_reg().
Referenced by test_error().
|
protectedvirtual |
Definition at line 124 of file BMI055_gyro.cpp.
References _checked_bad, _checked_values, BMI055::_whoami, BMI055_GYR_CHIP_ID, BMI055_GYR_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_gyro.cpp.
References _checked_registers, _checked_values, BMI055_GYR_BW, BMI055_GYR_DRDY_INT1, BMI055_GYR_DRDY_INT_EN, BMI055_GYR_INT_EN_0, BMI055_GYR_INT_MAP_1, BMI055_GYR_LPM1, BMI055_GYR_RANGE, BMI055_GYR_SOFTRESET, BMI055_GYRO_DEFAULT_RANGE_DPS, BMI055_GYRO_DEFAULT_RATE, BMI055_GYRO_NORMAL, BMI055_GYRO_NUM_CHECKED_REGISTERS, BMI055_SOFT_RESET, gyro_set_sample_rate(), OK, BMI055::read_reg(), set_gyro_range(), write_checked_reg(), and BMI055::write_reg().
Referenced by init().
|
overrideprivate |
Definition at line 271 of file BMI055_gyro.cpp.
References measure().
|
private |
Set the BMI055_gyro measurement range.
max_dps | The maximum DPS value the range must support. |
Definition at line 208 of file BMI055_gyro.cpp.
References _px4_gyro, BMI055_GYR_RANGE, BMI055_GYRO_RANGE_1000_DPS, BMI055_GYRO_RANGE_125_DPS, BMI055_GYRO_RANGE_2000_DPS, BMI055_GYRO_RANGE_250_DPS, BMI055_GYRO_RANGE_500_DPS, f(), M_PI_F, modify_reg(), OK, and PX4Gyroscope::set_scale().
Referenced by reset().
void BMI055_gyro::start | ( | ) |
Definition at line 255 of file BMI055_gyro.cpp.
References BMI055_GYRO_DEFAULT_RATE, BMI055_TIMER_REDUCTION, and stop().
|
private |
Stop automatic measurement.
Definition at line 265 of file BMI055_gyro.cpp.
Referenced by start(), and ~BMI055_gyro().
void BMI055_gyro::test_error | ( | ) |
Definition at line 178 of file BMI055_gyro.cpp.
References BMI055_GYR_SOFTRESET, BMI055_SOFT_RESET, print_registers(), and BMI055::write_reg().
|
private |
Write a register in the BMI055_gyro, updating _checked_values.
reg | The register to write. |
value | The new value to write. |
Definition at line 195 of file BMI055_gyro.cpp.
References _checked_bad, _checked_registers, _checked_values, BMI055_GYRO_NUM_CHECKED_REGISTERS, and BMI055::write_reg().
Referenced by modify_reg(), and reset().
|
private |
Definition at line 165 of file BMI055_gyro.hpp.
Referenced by check_registers(), measure(), print_info(), and ~BMI055_gyro().
|
private |
Definition at line 164 of file BMI055_gyro.hpp.
Referenced by measure(), print_info(), and ~BMI055_gyro().
|
private |
Definition at line 173 of file BMI055_gyro.hpp.
Referenced by check_registers(), print_info(), probe(), and write_checked_reg().
|
staticprivate |
Definition at line 171 of file BMI055_gyro.hpp.
Referenced by check_registers(), print_info(), print_registers(), reset(), and write_checked_reg().
|
private |
Definition at line 172 of file BMI055_gyro.hpp.
Referenced by check_registers(), print_info(), probe(), reset(), and write_checked_reg().
|
private |
Definition at line 161 of file BMI055_gyro.hpp.
Referenced by BMI055_gyro(), measure(), print_info(), and set_gyro_range().
|
private |
Definition at line 163 of file BMI055_gyro.hpp.
Referenced by measure(), print_info(), and ~BMI055_gyro().