M5Unified
m5::MPU6886_Class Class Reference

#include <MPU6886_Class.hpp>

Inheritance diagram for m5::MPU6886_Class:
Collaboration diagram for m5::MPU6886_Class:

Public Types

enum  Ascale { AFS_2G = 0 , AFS_4G , AFS_8G , AFS_16G }
 
enum  Gscale { GFS_250DPS = 0 , GFS_500DPS , GFS_1000DPS , GFS_2000DPS }
 
enum  Fodr {
  ODR_1kHz = 0 , ODR_500Hz = 1 , ODR_250Hz = 3 , ODR_200Hz = 4 ,
  ODR_125Hz = 7 , ODR_100Hz = 9 , ODR_50Hz = 19 , ODR_10Hz = 99
}
 
- Public Types inherited from m5::IMU_Base
enum  imu_spec_t { imu_spec_none = 0 , imu_spec_accel = 0b0001 , imu_spec_gyro = 0b0010 , imu_spec_mag = 0b0100 }
 

Public Member Functions

virtual ~MPU6886_Class ()
 
 MPU6886_Class (std::uint8_t i2c_addr=DEFAULT_ADDRESS, std::uint32_t freq=400000, I2C_Class *i2c=&In_I2C)
 
imu_spec_t begin (I2C_Class *i2c=nullptr) override
 
imu_spec_t getImuRawData (imu_raw_data_t *data) const override
 
void getConvertParam (imu_convert_param_t *param) const
 
bool getTempAdc (int16_t *adc) const override
 
void enableFIFO (Fodr output_data_rate)
 
bool setGyroAdcOffset (std::int16_t gx, std::int16_t gy, std::int16_t gz)
 
bool setINTPinActiveLogic (bool level) override
 
std::uint8_t whoAmI (void) const
 
- Public Member Functions inherited from m5::IMU_Base
virtual ~IMU_Base ()
 
 IMU_Base (std::uint8_t i2c_addr, std::uint32_t freq=400000, I2C_Class *i2c=&In_I2C)
 
- Public Member Functions inherited from m5::I2C_Device
 I2C_Device (std::uint8_t i2c_addr, std::uint32_t freq, I2C_Class *i2c=&In_I2C)
 
void setPort (I2C_Class *i2c)
 
bool writeRegister8 (std::uint8_t reg, std::uint8_t data) const
 
std::uint8_t readRegister8 (std::uint8_t reg) const
 
bool writeRegister8Array (const std::uint8_t *reg_data_array, std::size_t length) const
 
bool writeRegister (std::uint8_t reg, const std::uint8_t *data, std::size_t length) const
 
bool readRegister (std::uint8_t reg, std::uint8_t *result, std::size_t length) const
 
bool bitOn (std::uint8_t reg, std::uint8_t bit) const
 
bool bitOff (std::uint8_t reg, std::uint8_t bit) const
 
bool isEnabled (void) const
 

Static Public Attributes

static constexpr const std::uint8_t DEV_ID_MPU6886 = 0x19
 
static constexpr const std::uint8_t DEV_ID_MPU6050 = 0x68
 
static constexpr const std::uint8_t DEV_ID_MPU9250 = 0x71
 
static constexpr const std::uint8_t REG_WHOAMI = 0x75
 
static constexpr const std::uint8_t REG_ACCEL_INTEL_CTRL = 0x69
 
static constexpr const std::uint8_t REG_SMPLRT_DIV = 0x19
 
static constexpr const std::uint8_t REG_INT_PIN_CFG = 0x37
 
static constexpr const std::uint8_t REG_INT_ENABLE = 0x38
 
static constexpr const std::uint8_t REG_ACCEL_XOUT_H = 0x3B
 
static constexpr const std::uint8_t REG_ACCEL_XOUT_L = 0x3C
 
static constexpr const std::uint8_t REG_ACCEL_YOUT_H = 0x3D
 
static constexpr const std::uint8_t REG_ACCEL_YOUT_L = 0x3E
 
static constexpr const std::uint8_t REG_ACCEL_ZOUT_H = 0x3F
 
static constexpr const std::uint8_t REG_ACCEL_ZOUT_L = 0x40
 
static constexpr const std::uint8_t REG_TEMP_OUT_H = 0x41
 
static constexpr const std::uint8_t REG_TEMP_OUT_L = 0x42
 
static constexpr const std::uint8_t REG_GYRO_XOUT_H = 0x43
 
static constexpr const std::uint8_t REG_GYRO_XOUT_L = 0x44
 
static constexpr const std::uint8_t REG_GYRO_YOUT_H = 0x45
 
static constexpr const std::uint8_t REG_GYRO_YOUT_L = 0x46
 
static constexpr const std::uint8_t REG_GYRO_ZOUT_H = 0x47
 
static constexpr const std::uint8_t REG_GYRO_ZOUT_L = 0x48
 
static constexpr const std::uint8_t REG_USER_CTRL = 0x6A
 
static constexpr const std::uint8_t REG_PWR_MGMT_1 = 0x6B
 
static constexpr const std::uint8_t REG_PWR_MGMT_2 = 0x6C
 
static constexpr const std::uint8_t REG_CONFIG = 0x1A
 
static constexpr const std::uint8_t REG_GYRO_CONFIG = 0x1B
 
static constexpr const std::uint8_t REG_ACCEL_CONFIG = 0x1C
 
static constexpr const std::uint8_t REG_ACCEL_CONFIG2 = 0x1D
 
static constexpr const std::uint8_t REG_LP_MODE_CFG = 0x1E
 
static constexpr const std::uint8_t REG_FIFO_EN = 0x23
 
static constexpr const std::uint8_t REG_FIFO_COUNTH = 0x72
 
static constexpr const std::uint8_t REG_FIFO_R_W = 0x74
 
static constexpr std::uint8_t DEFAULT_ADDRESS = 0x68
 

Protected Member Functions

void setGyroFsr (Gscale scale)
 
void setAccelFsr (Ascale scale)
 

Protected Attributes

bool _fifo_en
 
float _aRes
 
float _gRes
 
Gscale _gscale
 
Ascale _ascale
 
std::uint8_t _device_id = 0
 
- Protected Attributes inherited from m5::I2C_Device
I2C_Class_i2c
 
std::uint32_t _freq
 
std::uint8_t _addr
 
bool _init
 

Detailed Description

Definition at line 11 of file MPU6886_Class.hpp.

Member Enumeration Documentation

◆ Ascale

Enumerator
AFS_2G 
AFS_4G 
AFS_8G 
AFS_16G 

Definition at line 53 of file MPU6886_Class.hpp.

◆ Fodr

Enumerator
ODR_1kHz 
ODR_500Hz 
ODR_250Hz 
ODR_200Hz 
ODR_125Hz 
ODR_100Hz 
ODR_50Hz 
ODR_10Hz 

Definition at line 67 of file MPU6886_Class.hpp.

◆ Gscale

Enumerator
GFS_250DPS 
GFS_500DPS 
GFS_1000DPS 
GFS_2000DPS 

Definition at line 60 of file MPU6886_Class.hpp.

Constructor & Destructor Documentation

◆ ~MPU6886_Class()

virtual m5::MPU6886_Class::~MPU6886_Class ( )
virtual

◆ MPU6886_Class()

m5::MPU6886_Class::MPU6886_Class ( std::uint8_t  i2c_addr = DEFAULT_ADDRESS,
std::uint32_t  freq = 400000,
I2C_Class i2c = &In_I2C 
)

Member Function Documentation

◆ begin()

imu_spec_t m5::MPU6886_Class::begin ( I2C_Class i2c = nullptr)
overridevirtual

Implements m5::IMU_Base.

◆ enableFIFO()

void m5::MPU6886_Class::enableFIFO ( Fodr  output_data_rate)

◆ getConvertParam()

void m5::MPU6886_Class::getConvertParam ( imu_convert_param_t param) const
virtual

Implements m5::IMU_Base.

◆ getImuRawData()

imu_spec_t m5::MPU6886_Class::getImuRawData ( imu_raw_data_t data) const
overridevirtual

Implements m5::IMU_Base.

◆ getTempAdc()

bool m5::MPU6886_Class::getTempAdc ( int16_t *  adc) const
overridevirtual

Reimplemented from m5::IMU_Base.

◆ setAccelFsr()

void m5::MPU6886_Class::setAccelFsr ( Ascale  scale)
protected

◆ setGyroAdcOffset()

bool m5::MPU6886_Class::setGyroAdcOffset ( std::int16_t  gx,
std::int16_t  gy,
std::int16_t  gz 
)

◆ setGyroFsr()

void m5::MPU6886_Class::setGyroFsr ( Gscale  scale)
protected

◆ setINTPinActiveLogic()

bool m5::MPU6886_Class::setINTPinActiveLogic ( bool  level)
overridevirtual

Reimplemented from m5::IMU_Base.

◆ whoAmI()

std::uint8_t m5::MPU6886_Class::whoAmI ( void  ) const
inline

Definition at line 104 of file MPU6886_Class.hpp.

Member Data Documentation

◆ _aRes

float m5::MPU6886_Class::_aRes
protected

Definition at line 111 of file MPU6886_Class.hpp.

◆ _ascale

Ascale m5::MPU6886_Class::_ascale
protected

Definition at line 113 of file MPU6886_Class.hpp.

◆ _device_id

std::uint8_t m5::MPU6886_Class::_device_id = 0
protected

Definition at line 114 of file MPU6886_Class.hpp.

◆ _fifo_en

bool m5::MPU6886_Class::_fifo_en
protected

Definition at line 110 of file MPU6886_Class.hpp.

◆ _gRes

float m5::MPU6886_Class::_gRes
protected

Definition at line 111 of file MPU6886_Class.hpp.

◆ _gscale

Gscale m5::MPU6886_Class::_gscale
protected

Definition at line 112 of file MPU6886_Class.hpp.

◆ DEFAULT_ADDRESS

constexpr std::uint8_t m5::MPU6886_Class::DEFAULT_ADDRESS = 0x68
staticconstexpr

Definition at line 82 of file MPU6886_Class.hpp.

◆ DEV_ID_MPU6050

constexpr const std::uint8_t m5::MPU6886_Class::DEV_ID_MPU6050 = 0x68
staticconstexpr

Definition at line 15 of file MPU6886_Class.hpp.

◆ DEV_ID_MPU6886

constexpr const std::uint8_t m5::MPU6886_Class::DEV_ID_MPU6886 = 0x19
staticconstexpr

Definition at line 14 of file MPU6886_Class.hpp.

◆ DEV_ID_MPU9250

constexpr const std::uint8_t m5::MPU6886_Class::DEV_ID_MPU9250 = 0x71
staticconstexpr

Definition at line 16 of file MPU6886_Class.hpp.

◆ REG_ACCEL_CONFIG

constexpr const std::uint8_t m5::MPU6886_Class::REG_ACCEL_CONFIG = 0x1C
staticconstexpr

Definition at line 45 of file MPU6886_Class.hpp.

◆ REG_ACCEL_CONFIG2

constexpr const std::uint8_t m5::MPU6886_Class::REG_ACCEL_CONFIG2 = 0x1D
staticconstexpr

Definition at line 46 of file MPU6886_Class.hpp.

◆ REG_ACCEL_INTEL_CTRL

constexpr const std::uint8_t m5::MPU6886_Class::REG_ACCEL_INTEL_CTRL = 0x69
staticconstexpr

Definition at line 19 of file MPU6886_Class.hpp.

◆ REG_ACCEL_XOUT_H

constexpr const std::uint8_t m5::MPU6886_Class::REG_ACCEL_XOUT_H = 0x3B
staticconstexpr

Definition at line 23 of file MPU6886_Class.hpp.

◆ REG_ACCEL_XOUT_L

constexpr const std::uint8_t m5::MPU6886_Class::REG_ACCEL_XOUT_L = 0x3C
staticconstexpr

Definition at line 24 of file MPU6886_Class.hpp.

◆ REG_ACCEL_YOUT_H

constexpr const std::uint8_t m5::MPU6886_Class::REG_ACCEL_YOUT_H = 0x3D
staticconstexpr

Definition at line 25 of file MPU6886_Class.hpp.

◆ REG_ACCEL_YOUT_L

constexpr const std::uint8_t m5::MPU6886_Class::REG_ACCEL_YOUT_L = 0x3E
staticconstexpr

Definition at line 26 of file MPU6886_Class.hpp.

◆ REG_ACCEL_ZOUT_H

constexpr const std::uint8_t m5::MPU6886_Class::REG_ACCEL_ZOUT_H = 0x3F
staticconstexpr

Definition at line 27 of file MPU6886_Class.hpp.

◆ REG_ACCEL_ZOUT_L

constexpr const std::uint8_t m5::MPU6886_Class::REG_ACCEL_ZOUT_L = 0x40
staticconstexpr

Definition at line 28 of file MPU6886_Class.hpp.

◆ REG_CONFIG

constexpr const std::uint8_t m5::MPU6886_Class::REG_CONFIG = 0x1A
staticconstexpr

Definition at line 43 of file MPU6886_Class.hpp.

◆ REG_FIFO_COUNTH

constexpr const std::uint8_t m5::MPU6886_Class::REG_FIFO_COUNTH = 0x72
staticconstexpr

Definition at line 50 of file MPU6886_Class.hpp.

◆ REG_FIFO_EN

constexpr const std::uint8_t m5::MPU6886_Class::REG_FIFO_EN = 0x23
staticconstexpr

Definition at line 48 of file MPU6886_Class.hpp.

◆ REG_FIFO_R_W

constexpr const std::uint8_t m5::MPU6886_Class::REG_FIFO_R_W = 0x74
staticconstexpr

Definition at line 51 of file MPU6886_Class.hpp.

◆ REG_GYRO_CONFIG

constexpr const std::uint8_t m5::MPU6886_Class::REG_GYRO_CONFIG = 0x1B
staticconstexpr

Definition at line 44 of file MPU6886_Class.hpp.

◆ REG_GYRO_XOUT_H

constexpr const std::uint8_t m5::MPU6886_Class::REG_GYRO_XOUT_H = 0x43
staticconstexpr

Definition at line 33 of file MPU6886_Class.hpp.

◆ REG_GYRO_XOUT_L

constexpr const std::uint8_t m5::MPU6886_Class::REG_GYRO_XOUT_L = 0x44
staticconstexpr

Definition at line 34 of file MPU6886_Class.hpp.

◆ REG_GYRO_YOUT_H

constexpr const std::uint8_t m5::MPU6886_Class::REG_GYRO_YOUT_H = 0x45
staticconstexpr

Definition at line 35 of file MPU6886_Class.hpp.

◆ REG_GYRO_YOUT_L

constexpr const std::uint8_t m5::MPU6886_Class::REG_GYRO_YOUT_L = 0x46
staticconstexpr

Definition at line 36 of file MPU6886_Class.hpp.

◆ REG_GYRO_ZOUT_H

constexpr const std::uint8_t m5::MPU6886_Class::REG_GYRO_ZOUT_H = 0x47
staticconstexpr

Definition at line 37 of file MPU6886_Class.hpp.

◆ REG_GYRO_ZOUT_L

constexpr const std::uint8_t m5::MPU6886_Class::REG_GYRO_ZOUT_L = 0x48
staticconstexpr

Definition at line 38 of file MPU6886_Class.hpp.

◆ REG_INT_ENABLE

constexpr const std::uint8_t m5::MPU6886_Class::REG_INT_ENABLE = 0x38
staticconstexpr

Definition at line 22 of file MPU6886_Class.hpp.

◆ REG_INT_PIN_CFG

constexpr const std::uint8_t m5::MPU6886_Class::REG_INT_PIN_CFG = 0x37
staticconstexpr

Definition at line 21 of file MPU6886_Class.hpp.

◆ REG_LP_MODE_CFG

constexpr const std::uint8_t m5::MPU6886_Class::REG_LP_MODE_CFG = 0x1E
staticconstexpr

Definition at line 47 of file MPU6886_Class.hpp.

◆ REG_PWR_MGMT_1

constexpr const std::uint8_t m5::MPU6886_Class::REG_PWR_MGMT_1 = 0x6B
staticconstexpr

Definition at line 41 of file MPU6886_Class.hpp.

◆ REG_PWR_MGMT_2

constexpr const std::uint8_t m5::MPU6886_Class::REG_PWR_MGMT_2 = 0x6C
staticconstexpr

Definition at line 42 of file MPU6886_Class.hpp.

◆ REG_SMPLRT_DIV

constexpr const std::uint8_t m5::MPU6886_Class::REG_SMPLRT_DIV = 0x19
staticconstexpr

Definition at line 20 of file MPU6886_Class.hpp.

◆ REG_TEMP_OUT_H

constexpr const std::uint8_t m5::MPU6886_Class::REG_TEMP_OUT_H = 0x41
staticconstexpr

Definition at line 30 of file MPU6886_Class.hpp.

◆ REG_TEMP_OUT_L

constexpr const std::uint8_t m5::MPU6886_Class::REG_TEMP_OUT_L = 0x42
staticconstexpr

Definition at line 31 of file MPU6886_Class.hpp.

◆ REG_USER_CTRL

constexpr const std::uint8_t m5::MPU6886_Class::REG_USER_CTRL = 0x6A
staticconstexpr

Definition at line 40 of file MPU6886_Class.hpp.

◆ REG_WHOAMI

constexpr const std::uint8_t m5::MPU6886_Class::REG_WHOAMI = 0x75
staticconstexpr

Definition at line 18 of file MPU6886_Class.hpp.


The documentation for this class was generated from the following file: