M5Unit-IMU 0.0.2 git rev:e5b00aa
Loading...
Searching...
No Matches
m5::unit::UnitMPU6050 Class Reference

TDK InvenSense MPU-6050 6-axis IMU (accel + gyro + temp). WHO_AM_I 0x68. More...

#include <unit_mpu6050.hpp>

Inheritance diagram for m5::unit::UnitMPU6050:
m5::unit::UnitMPU6xxx m5::imu::IMUDataSource

Public Member Functions

 UnitMPU6050 (const uint8_t addr=DEFAULT_ADDRESS)
 
- Public Member Functions inherited from m5::unit::UnitMPU6xxx
virtual bool begin () override
 Begin the unit.
 
virtual void update (const bool force=false) override
 Update the unit.
 
config_t config () const
 Gets the configuration.
 
void config (const config_t &cfg)
 Set the configuration.
 
bool writeAccelRange (const mpu6886::AccelRange range)
 Write the accelerometer range.
 
bool writeGyroRange (const mpu6886::GyroRange range)
 Write the gyroscope range.
 
bool readAccelRange (mpu6886::AccelRange &range)
 Read the accelerometer range from the device (REG_ACCEL_CONFIG bits[4:3])
 
bool readGyroRange (mpu6886::GyroRange &range)
 Read the gyroscope range from the device (REG_GYRO_CONFIG bits[4:3])
 
bool writeSampleRateDiv (const uint8_t div)
 Write the sample rate divider.
 
bool readSampleRateDiv (uint8_t &div)
 Read the sample rate divider from the device (REG_SMPLRT_DIV)
 
bool writeDlpf (const mpu6886::Dlpf dlpf)
 Write the digital low-pass filter bandwidth.
 
bool readDlpf (mpu6886::Dlpf &dlpf)
 Read the digital low-pass filter bandwidth from the device (REG_CONFIG bits[2:0])
 
bool softReset ()
 Soft reset (REG_PWR_MGMT_1 DEVICE_RESET), leaving the chip initialized but unconfigured and stopped.
 
bool startPeriodicMeasurement (const mpu6886::AccelRange accel_range, const mpu6886::GyroRange gyro_range, const mpu6886::Dlpf dlpf, const uint8_t sample_rate_div)
 Start periodic measurement.
 
bool startPeriodicMeasurement ()
 Start periodic measurement in the current settings.
 
bool stopPeriodicMeasurement ()
 Stop periodic measurement.
 
bool sleep () override
 Put the chip to sleep (REG_PWR_MGMT_1 SLEEP)
 
bool wakeup () override
 Wake the chip from sleep()
 
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.
 

Protected Member Functions

bool accepts_whoami (const uint8_t id) const override
 Accepted WHO_AM_I id(s) for this chip; begin() rejects the device unless this returns true.
 
float temperature_res () const override
 Temperature conversion: degC per LSB (imu_convert_param_t::temp_res)
 
float temperature_offset () const override
 Temperature conversion: degC offset (imu_convert_param_t::temp_offset)
 
- Protected Member Functions inherited from m5::unit::UnitMPU6xxx
 UnitMPU6xxx (const uint8_t addr=DEFAULT_ADDRESS)
 Protected: UnitMPU6xxx is abstract, constructed only by concrete derived chips.
 
virtual bool start_periodic_measurement (const mpu6886::AccelRange accel_range, const mpu6886::GyroRange gyro_range, const mpu6886::Dlpf dlpf, const uint8_t sample_rate_div)
 Virtual: UnitMPU9250 layers its aux-bypass re-open on top (the config write here includes INT_PIN_CFG=0xC0, which closes the bypass)
 
bool start_periodic_measurement ()
 
bool stop_periodic_measurement ()
 
bool read_measurement (mpu6886::Data &d)
 
bool write_register8_verified (const uint8_t reg, const uint8_t val)
 
 M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitMPU6xxx, mpu6886::Data)
 

Detailed Description

TDK InvenSense MPU-6050 6-axis IMU (accel + gyro + temp). WHO_AM_I 0x68.

Member Function Documentation

◆ accepts_whoami()

bool m5::unit::UnitMPU6050::accepts_whoami ( const uint8_t id) const
inlineoverrideprotectedvirtual

Accepted WHO_AM_I id(s) for this chip; begin() rejects the device unless this returns true.

Implements m5::unit::UnitMPU6xxx.

◆ temperature_offset()

float m5::unit::UnitMPU6050::temperature_offset ( ) const
inlineoverrideprotectedvirtual

Temperature conversion: degC offset (imu_convert_param_t::temp_offset)

Implements m5::unit::UnitMPU6xxx.

◆ temperature_res()

float m5::unit::UnitMPU6050::temperature_res ( ) const
inlineoverrideprotectedvirtual

Temperature conversion: degC per LSB (imu_convert_param_t::temp_res)

Implements m5::unit::UnitMPU6xxx.