|
M5Unit-IMU 0.0.2 git rev:e5b00aa
|
Senodia SH200Q 6-axis IMU (accel + gyro + temp). No standalone GROVE unit exists; it is the built-in IMU of the earliest (2019.3) M5StickC and of the 2019.7 M5Stack Fire (there paired with a discrete BMM150 magnetometer), on the internal I2C bus at 0x6C. More...
#include <unit_sh200q.hpp>
Classes | |
| struct | config_t |
| Settings for begin() More... | |
Public Member Functions | |
| UnitSH200Q (const uint8_t addr=DEFAULT_ADDRESS) | |
| Construct with the I2C address the chip will answer on. | |
| virtual | ~UnitSH200Q () |
| Destructor. | |
| virtual bool | begin () override |
| Begin the unit. | |
| virtual void | update (const bool force=false) override |
| Update the unit. | |
Settings | |
| config_t | config () const |
| Gets the configuration. | |
| void | config (const config_t &cfg) |
| Set the configuration. | |
Range setting (stop periodic measurement first) | |
| bool | writeAccelRange (const sh200q::AccelRange range) |
| Write the accelerometer range. | |
| bool | writeGyroRange (const sh200q::GyroRange range) |
| Write the gyroscope range. | |
| bool | readAccelRange (sh200q::AccelRange &range) |
| Read the accelerometer range from the device (REG_ACC_RANGE bits[1:0]) | |
| bool | readGyroRange (sh200q::GyroRange &range) |
| Read the gyroscope range from the device (REG_GYRO_RANGE bits[2:0]) | |
Output data rate (stop periodic measurement first) | |
| bool | writeAccelOdr (const sh200q::AccelOdr odr) |
| Write the accelerometer output data rate. | |
| bool | writeGyroOdr (const sh200q::GyroOdr odr) |
| Write the gyroscope output data rate. | |
| bool | readAccelOdr (sh200q::AccelOdr &odr) |
| Read the accelerometer output data rate from the device (REG_ACC_CONFIG bits[4:3]) | |
| bool | readGyroOdr (sh200q::GyroOdr &odr) |
| Read the gyroscope output data rate from the device (REG_GYRO_CONFIG bits[3:1]) | |
Reset | |
| bool | softReset () |
| Soft reset (the undocumented ADC/init reset dance inherited from the original library), leaving the chip initialized but unconfigured and stopped. | |
Periodic measurement | |
| bool | startPeriodicMeasurement (const sh200q::AccelRange accel_range, const sh200q::GyroRange gyro_range, const sh200q::AccelOdr accel_odr, const sh200q::GyroOdr gyro_odr, const sh200q::GyroDlpf gyro_dlpf) |
| Start periodic measurement. | |
| bool | startPeriodicMeasurement () |
| Start periodic measurement in the current settings. | |
| bool | stopPeriodicMeasurement () |
| Mark periodic measurement as stopped (bookkeeping only; the chip stays running – call sleep() to power-down for actual quiescence) | |
IMUDataSource | |
| virtual m5::imu::Capability | imuSpec () const override |
| Capability of this unit. | |
| virtual m5::imu::Capability | readImuRaw (m5::imu::imu_raw_data_t &out) override |
| Read the latest raw IMU data. | |
| virtual void | imuConvertParam (m5::imu::imu_convert_param_t &out) const override |
| Gets the conversion parameters for raw IMU data. | |
Public Member Functions inherited from m5::imu::IMUDataSource | |
| virtual bool | sleep () |
| Put the device into its lowest reversible power state. | |
| virtual bool | wakeup () |
| Bring the device back from sleep() | |
Protected Member Functions | |
| bool | start_periodic_measurement (const sh200q::AccelRange accel_range, const sh200q::GyroRange gyro_range, const sh200q::AccelOdr accel_odr, const sh200q::GyroOdr gyro_odr, const sh200q::GyroDlpf gyro_dlpf) |
| bool | start_periodic_measurement () |
| bool | stop_periodic_measurement () |
| bool | read_measurement (sh200q::Data &d) |
| bool | write_register8_verified (const uint8_t reg, const uint8_t val) |
| bool | toggle_register_bits (const uint8_t reg, const uint8_t bits) |
| M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitSH200Q, sh200q::Data) | |
Senodia SH200Q 6-axis IMU (accel + gyro + temp). No standalone GROVE unit exists; it is the built-in IMU of the earliest (2019.3) M5StickC and of the 2019.7 M5Stack Fire (there paired with a discrete BMM150 magnetometer), on the internal I2C bus at 0x6C.
|
explicit |
Construct with the I2C address the chip will answer on.
| [in] | addr | I2C address (defaults to the chip's factory address) |
|
overridevirtual |
Gets the conversion parameters for raw IMU data.
| [out] | out | Destination for the scale factors this driver applies |
Implements m5::imu::IMUDataSource.
|
inlineoverridevirtual |
| bool m5::unit::UnitSH200Q::readAccelOdr | ( | sh200q::AccelOdr & | odr | ) |
Read the accelerometer output data rate from the device (REG_ACC_CONFIG bits[4:3])
| [out] | odr | Accelerometer output data rate |
| bool m5::unit::UnitSH200Q::readAccelRange | ( | sh200q::AccelRange & | range | ) |
Read the accelerometer range from the device (REG_ACC_RANGE bits[1:0])
| [out] | range | Accelerometer range |
| bool m5::unit::UnitSH200Q::readGyroOdr | ( | sh200q::GyroOdr & | odr | ) |
Read the gyroscope output data rate from the device (REG_GYRO_CONFIG bits[3:1])
| [out] | odr | Gyroscope output data rate |
| bool m5::unit::UnitSH200Q::readGyroRange | ( | sh200q::GyroRange & | range | ) |
Read the gyroscope range from the device (REG_GYRO_RANGE bits[2:0])
| [out] | range | Gyroscope range |
|
overridevirtual |
Read the latest raw IMU data.
| [out] | out | Destination buffer filled with the most recent sample |
Implements m5::imu::IMUDataSource.
| bool m5::unit::UnitSH200Q::softReset | ( | ) |
Soft reset (the undocumented ADC/init reset dance inherited from the original library), leaving the chip initialized but unconfigured and stopped.
| bool m5::unit::UnitSH200Q::startPeriodicMeasurement | ( | const sh200q::AccelRange | accel_range, |
| const sh200q::GyroRange | gyro_range, | ||
| const sh200q::AccelOdr | accel_odr, | ||
| const sh200q::GyroOdr | gyro_odr, | ||
| const sh200q::GyroDlpf | gyro_dlpf ) |
Start periodic measurement.
| accel_range | Accelerometer range |
| gyro_range | Gyroscope range |
| accel_odr | Accelerometer output data rate |
| gyro_odr | Gyroscope output data rate (also paces the periodic measurement) |
| gyro_dlpf | Gyro low pass filter |
| bool m5::unit::UnitSH200Q::stopPeriodicMeasurement | ( | ) |
Mark periodic measurement as stopped (bookkeeping only; the chip stays running – call sleep() to power-down for actual quiescence)
|
overridevirtual |
Update the unit.
| [in] | force | Forces an update if true, even if not time for periodic measurement |
| bool m5::unit::UnitSH200Q::writeAccelOdr | ( | const sh200q::AccelOdr | odr | ) |
Write the accelerometer output data rate.
| [in] | odr | Accelerometer output data rate |
| bool m5::unit::UnitSH200Q::writeAccelRange | ( | const sh200q::AccelRange | range | ) |
Write the accelerometer range.
| [in] | range | Accelerometer range |
| bool m5::unit::UnitSH200Q::writeGyroOdr | ( | const sh200q::GyroOdr | odr | ) |
Write the gyroscope output data rate.
| [in] | odr | Gyroscope output data rate |
| bool m5::unit::UnitSH200Q::writeGyroRange | ( | const sh200q::GyroRange | range | ) |
Write the gyroscope range.
| [in] | range | Gyroscope range |