PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <BMI088_gyro.hpp>
Classes | |
struct | BMI_GyroReport |
Report conversation within the BMI088_gyro, including command byte and interrupt status. More... | |
Public Member Functions | |
BMI088_gyro (int bus, const char *path_gyro, uint32_t device, enum Rotation rotation) | |
virtual | ~BMI088_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 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 | |
virtual uint8_t | read_reg (unsigned reg) |
Read a register from the BMI088. More... | |
virtual uint16_t | read_reg16 (unsigned reg) |
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_gyro. More... | |
void | write_checked_reg (unsigned reg, uint8_t value) |
Write a register in the BMI088_gyro, updating _checked_values. More... | |
int | set_gyro_range (unsigned max_dps) |
Set the BMI088_gyro measurement range. More... | |
int | gyro_set_sample_rate (float desired_sample_rate_hz) |
void | check_registers (void) |
BMI088_gyro (const BMI088_gyro &) | |
BMI088_gyro | operator= (const BMI088_gyro &) |
Static Private Member Functions | |
static void | measure_trampoline (void *arg) |
Static trampoline from the hrt_call context; because we don't have a generic hrt wrapper yet. More... | |
Private Attributes | |
PX4Gyroscope | _px4_gyro |
perf_counter_t | _sample_perf |
perf_counter_t | _bad_transfers |
perf_counter_t | _bad_registers |
uint8_t | _checked_values [BMI088_GYRO_NUM_CHECKED_REGISTERS] |
uint8_t | _checked_bad [BMI088_GYRO_NUM_CHECKED_REGISTERS] |
float | _last_temperature |
Static Private Attributes | |
static const uint8_t | _checked_registers [BMI088_GYRO_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 132 of file BMI088_gyro.hpp.
BMI088_gyro::BMI088_gyro | ( | int | bus, |
const char * | path_gyro, | ||
uint32_t | device, | ||
enum Rotation | rotation | ||
) |
Definition at line 58 of file BMI088_gyro.cpp.
References _px4_gyro, DRV_DEVTYPE_BMI088, and PX4Gyroscope::set_device_type().
|
virtual |
Definition at line 69 of file BMI088_gyro.cpp.
References _bad_registers, _bad_transfers, _sample_perf, perf_free(), and stop().
|
private |
|
private |
Definition at line 296 of file BMI088_gyro.cpp.
References _bad_registers, _checked_bad, BMI088::_checked_next, _checked_registers, _checked_values, BMI088::_register_wait, BMI088::_reset_wait, BMI088_GYR_SOFTRESET, BMI088_GYRO_NUM_CHECKED_REGISTERS, BMI088_SOFT_RESET, hrt_absolute_time(), perf_count(), BMI088::read_reg(), and BMI088::write_reg().
Referenced by measure().
|
private |
Definition at line 153 of file BMI088_gyro.cpp.
References BMI088_GYR_BW, BMI088_GYRO_BW_MASK, BMI088_GYRO_RATE_100, BMI088_GYRO_RATE_1000, BMI088_GYRO_RATE_2000, BMI088_GYRO_RATE_400, modify_reg(), and OK.
Referenced by reset().
|
virtual |
Definition at line 81 of file BMI088_gyro.cpp.
References DEVICE_DEBUG, ToneAlarmInterface::init(), OK, and reset().
|
private |
Fetch measurements from the sensor and update the report buffers.
Definition at line 339 of file BMI088_gyro.cpp.
References _accel_last_temperature_copy, _bad_registers, _bad_transfers, _last_temperature, _px4_gyro, BMI088::_register_wait, BMI088::_reset_wait, _sample_perf, BMI088_GYR_X_L, check_registers(), BMI088_gyro::BMI_GyroReport::cmd, DIR_READ, hrt_absolute_time(), hrt_abstime, OK, perf_begin(), perf_count(), perf_end(), perf_event_count(), PX4Gyroscope::set_error_count(), PX4Gyroscope::set_temperature(), and PX4Gyroscope::update().
Referenced by measure_trampoline(), and Run().
|
staticprivate |
Static trampoline from the hrt_call context; because we don't have a generic hrt wrapper yet.
Called by the HRT in interrupt context at the specified rate if automatic polling is enabled.
arg | Instance pointer for the driver that is polling. |
Definition at line 287 of file BMI088_gyro.cpp.
References measure().
|
private |
Modify a register in the BMI088_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 195 of file BMI088_gyro.cpp.
References BMI088::read_reg(), and write_checked_reg().
Referenced by gyro_set_sample_rate(), and set_gyro_range().
|
private |
void BMI088_gyro::print_info | ( | ) |
Diagnostics - print some basic information about the driver.
Definition at line 429 of file BMI088_gyro.cpp.
References _bad_registers, _bad_transfers, _checked_bad, BMI088::_checked_next, _checked_registers, _checked_values, _px4_gyro, _sample_perf, BMI088_GYRO_NUM_CHECKED_REGISTERS, perf_print_counter(), PX4Gyroscope::print_status(), and BMI088::read_reg().
void BMI088_gyro::print_registers | ( | ) |
Definition at line 461 of file BMI088_gyro.cpp.
References _checked_registers, and BMI088::read_reg().
Referenced by test_error().
|
protectedvirtual |
Definition at line 132 of file BMI088_gyro.cpp.
References _checked_bad, _checked_values, BMI088::_whoami, BMI088_GYR_CHIP_ID, BMI088_GYR_WHO_AM_I, DEVICE_DEBUG, OK, and BMI088::read_reg().
|
private |
Reset chip.
Resets the chip and measurements ranges, but not scale and offset.
Definition at line 95 of file BMI088_gyro.cpp.
References _checked_registers, _checked_values, BMI088_GYR_BW, BMI088_GYR_DRDY_INT1, BMI088_GYR_DRDY_INT_EN, BMI088_GYR_INT_EN_0, BMI088_GYR_INT_MAP_1, BMI088_GYR_LPM1, BMI088_GYR_RANGE, BMI088_GYR_SOFTRESET, BMI088_GYRO_DEFAULT_RANGE_DPS, BMI088_GYRO_DEFAULT_RATE, BMI088_GYRO_NORMAL, BMI088_GYRO_NUM_CHECKED_REGISTERS, BMI088_SOFT_RESET, gyro_set_sample_rate(), OK, BMI088::read_reg(), set_gyro_range(), write_checked_reg(), and BMI088::write_reg().
Referenced by init().
|
overrideprivate |
Definition at line 280 of file BMI088_gyro.cpp.
References measure().
|
private |
Set the BMI088_gyro measurement range.
max_dps | The maximum DPS value the range must support. |
Definition at line 217 of file BMI088_gyro.cpp.
References _px4_gyro, BMI088_GYR_RANGE, BMI088_GYRO_RANGE_1000_DPS, BMI088_GYRO_RANGE_125_DPS, BMI088_GYRO_RANGE_2000_DPS, BMI088_GYRO_RANGE_250_DPS, BMI088_GYRO_RANGE_500_DPS, f(), M_PI_F, modify_reg(), OK, and PX4Gyroscope::set_scale().
Referenced by reset().
void BMI088_gyro::start | ( | ) |
Definition at line 264 of file BMI088_gyro.cpp.
References BMI088_GYRO_DEFAULT_RATE, BMI088_TIMER_REDUCTION, and stop().
|
private |
Stop automatic measurement.
Definition at line 274 of file BMI088_gyro.cpp.
Referenced by start(), and ~BMI088_gyro().
void BMI088_gyro::test_error | ( | ) |
Definition at line 187 of file BMI088_gyro.cpp.
References BMI088_GYR_SOFTRESET, BMI088_SOFT_RESET, print_registers(), and BMI088::write_reg().
|
private |
Write a register in the BMI088_gyro, updating _checked_values.
reg | The register to write. |
value | The new value to write. |
Definition at line 204 of file BMI088_gyro.cpp.
References _checked_bad, _checked_registers, _checked_values, BMI088_GYRO_NUM_CHECKED_REGISTERS, and BMI088::write_reg().
Referenced by modify_reg(), and reset().
|
private |
Definition at line 163 of file BMI088_gyro.hpp.
Referenced by check_registers(), measure(), print_info(), and ~BMI088_gyro().
|
private |
Definition at line 162 of file BMI088_gyro.hpp.
Referenced by measure(), print_info(), and ~BMI088_gyro().
|
private |
Definition at line 171 of file BMI088_gyro.hpp.
Referenced by check_registers(), print_info(), probe(), and write_checked_reg().
|
staticprivate |
Definition at line 169 of file BMI088_gyro.hpp.
Referenced by check_registers(), print_info(), print_registers(), reset(), and write_checked_reg().
|
private |
Definition at line 170 of file BMI088_gyro.hpp.
Referenced by check_registers(), print_info(), probe(), reset(), and write_checked_reg().
|
private |
Definition at line 174 of file BMI088_gyro.hpp.
Referenced by measure().
|
private |
Definition at line 159 of file BMI088_gyro.hpp.
Referenced by BMI088_gyro(), measure(), print_info(), and set_gyro_range().
|
private |
Definition at line 161 of file BMI088_gyro.hpp.
Referenced by measure(), print_info(), and ~BMI088_gyro().