Skip to content

Commit

Permalink
AP_InertialSensor: support dynamic configuration of highres IMUs
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per committed Apr 15, 2024
1 parent d964d7f commit 5ec9eac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions libraries/AP_InertialSensor/AP_InertialSensor_Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ void AP_InertialSensor_Backend::_set_gyro_oversampling(uint8_t instance, uint8_t
_imu._gyro_over_sampling[instance] = n;
}

#define BOARD_MATCH(board_type) AP_BoardConfig::get_board_type()==AP_BoardConfig::board_type

// should highres sampling be enabled on this IMU?
bool AP_InertialSensor_Backend::enable_highres_sampling(uint8_t instance) const
{
return (HAL_INS_HIGHRES_SAMPLE_MASK & (1U<<instance)) != 0;
}

/*
update the sensor rate for FIFO sensors
Expand Down
8 changes: 5 additions & 3 deletions libraries/AP_InertialSensor/AP_InertialSensor_Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#define HAL_INS_HIGHRES_SAMPLE 0
#endif

#ifndef HAL_INS_HIGHRES_SAMPLE_MASK
#define HAL_INS_HIGHRES_SAMPLE_MASK 0
#endif

class AuxiliaryBus;
class AP_Logger;

Expand Down Expand Up @@ -293,9 +297,7 @@ class AP_InertialSensor_Backend
}

// should highres sampling be enabled on this IMU?
bool enable_highres_sampling(uint8_t instance) const {
return (HAL_INS_HIGHRES_SAMPLE & (1U<<instance)) != 0;
}
bool enable_highres_sampling(uint8_t instance) const;

// if fast sampling is enabled, the rate to use in kHz
uint8_t get_fast_sampling_rate() const {
Expand Down

0 comments on commit 5ec9eac

Please sign in to comment.