Browse Source

bmi055 add measure interval perf counter

sbg
Daniel Agar 7 years ago committed by Lorenz Meier
parent
commit
e4be8eccc9
  1. 5
      src/drivers/imu/bmi055/BMI055_accel.cpp
  2. 1
      src/drivers/imu/bmi055/BMI055_accel.hpp
  3. 5
      src/drivers/imu/bmi055/BMI055_gyro.cpp
  4. 1
      src/drivers/imu/bmi055/BMI055_gyro.hpp

5
src/drivers/imu/bmi055/BMI055_accel.cpp

@ -49,6 +49,7 @@ const uint8_t BMI055_accel::_checked_registers[BMI055_ACCEL_NUM_CHECKED_REGISTER @@ -49,6 +49,7 @@ const uint8_t BMI055_accel::_checked_registers[BMI055_ACCEL_NUM_CHECKED_REGISTER
BMI055_accel::BMI055_accel(int bus, const char *path_accel, uint32_t device, enum Rotation rotation) :
BMI055("BMI055_ACCEL", path_accel, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation),
_sample_perf(perf_alloc(PC_ELAPSED, "bmi055_accel_read")),
_measure_interval(perf_alloc(PC_INTERVAL, "bmi055_accel_measure_interval")),
_bad_transfers(perf_alloc(PC_COUNT, "bmi055_accel_bad_transfers")),
_bad_registers(perf_alloc(PC_COUNT, "bmi055_accel_bad_registers")),
_duplicates(perf_alloc(PC_COUNT, "bmi055_accel_duplicates")),
@ -96,6 +97,7 @@ BMI055_accel::~BMI055_accel() @@ -96,6 +97,7 @@ BMI055_accel::~BMI055_accel()
/* delete the perf counter */
perf_free(_sample_perf);
perf_free(_measure_interval);
perf_free(_bad_transfers);
perf_free(_bad_registers);
perf_free(_duplicates);
@ -637,6 +639,8 @@ BMI055_accel::check_registers(void) @@ -637,6 +639,8 @@ BMI055_accel::check_registers(void)
void
BMI055_accel::measure()
{
perf_count(_measure_interval);
uint8_t index = 0, accel_data[7];
uint16_t lsb, msb, msblsb;
uint8_t status_x, status_y, status_z;
@ -805,6 +809,7 @@ BMI055_accel::print_info() @@ -805,6 +809,7 @@ BMI055_accel::print_info()
PX4_INFO("Accel");
perf_print_counter(_sample_perf);
perf_print_counter(_measure_interval);
perf_print_counter(_bad_transfers);
perf_print_counter(_bad_registers);
perf_print_counter(_duplicates);

1
src/drivers/imu/bmi055/BMI055_accel.hpp

@ -176,6 +176,7 @@ protected: @@ -176,6 +176,7 @@ protected:
private:
perf_counter_t _sample_perf;
perf_counter_t _measure_interval;
perf_counter_t _bad_transfers;
perf_counter_t _bad_registers;
perf_counter_t _duplicates;

5
src/drivers/imu/bmi055/BMI055_gyro.cpp

@ -50,6 +50,7 @@ const uint8_t BMI055_gyro::_checked_registers[BMI055_GYRO_NUM_CHECKED_REGISTERS] @@ -50,6 +50,7 @@ const uint8_t BMI055_gyro::_checked_registers[BMI055_GYRO_NUM_CHECKED_REGISTERS]
BMI055_gyro::BMI055_gyro(int bus, const char *path_gyro, uint32_t device, enum Rotation rotation) :
BMI055("BMI055_GYRO", path_gyro, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation),
_sample_perf(perf_alloc(PC_ELAPSED, "bmi055_gyro_read")),
_measure_interval(perf_alloc(PC_INTERVAL, "bmi055_gyro_measure_interval")),
_bad_transfers(perf_alloc(PC_COUNT, "bmi055_gyro_bad_transfers")),
_bad_registers(perf_alloc(PC_COUNT, "bmi055_gyro_bad_registers")),
_gyro_reports(nullptr),
@ -95,6 +96,7 @@ BMI055_gyro::~BMI055_gyro() @@ -95,6 +96,7 @@ BMI055_gyro::~BMI055_gyro()
/* delete the perf counter */
perf_free(_sample_perf);
perf_free(_measure_interval);
perf_free(_bad_transfers);
perf_free(_bad_registers);
}
@ -637,6 +639,8 @@ BMI055_gyro::check_registers(void) @@ -637,6 +639,8 @@ BMI055_gyro::check_registers(void)
void
BMI055_gyro::measure()
{
perf_count(_measure_interval);
if (hrt_absolute_time() < _reset_wait) {
// we're waiting for a reset to complete
return;
@ -779,6 +783,7 @@ BMI055_gyro::print_info() @@ -779,6 +783,7 @@ BMI055_gyro::print_info()
PX4_INFO("Gyro");
perf_print_counter(_sample_perf);
perf_print_counter(_measure_interval);
perf_print_counter(_bad_transfers);
perf_print_counter(_bad_registers);

1
src/drivers/imu/bmi055/BMI055_gyro.hpp

@ -168,6 +168,7 @@ protected: @@ -168,6 +168,7 @@ protected:
private:
perf_counter_t _sample_perf;
perf_counter_t _measure_interval;
perf_counter_t _bad_transfers;
perf_counter_t _bad_registers;

Loading…
Cancel
Save