types.hpp File Reference

Declare Types and Definitions used within mpud namespace. More...

Go to the source code of this file.

Classes

struct  mpud::types::mot_config_t
 Motion Detection configuration. More...
 
struct  mpud::types::zrmot_config_t
 Zero-motion configuration. More...
 
struct  mpud::types::ff_config_t
 Free-fall configuration. More...
 
struct  mpud::types::auxi2c_config_t
 Auxiliary I2C Master configuration struct. More...
 
struct  mpud::types::auxi2c_slv_config_t
 Auxiliary I2C Slave configuration struct. More...
 
struct  mpud::types::int_config_t
 Interrupt configuration struct. More...
 
struct  mpud::types::axes_t< type_t >
 Generic axes struct to store sensors' data. More...
 
struct  mpud::types::sensors_t
 Sensors struct for fast reading all sensors at once. More...
 

Namespaces

 mpud
 MPU Driver namespace.
 
 mpud::types
 Types namespace.
 

Typedefs

typedef I2C_t mpud::types::mpu_bus_t
 Communication bus type, I2Cbus or SPIbus. More...
 
typedef mpu_i2caddr_t mpud::types::mpu_addr_handle_t
 MPU Address/Handle type, mpu_i2caddr_t or spi_device_handle_t More...
 
typedef uint8_t mpud::types::mot_stat_t
 Motion Detection Status (MPU6000, MPU6050, MPU9150) More...
 
typedef uint8_t mpud::types::stby_en_t
 Standby Mode. More...
 
typedef uint8_t mpud::types::auxi2c_stat_t
 Auxiliary I2C master status register data. More...
 
typedef uint8_t mpud::types::int_en_t
 Enable features to generate signal at Interrupt pin. More...
 
typedef uint8_t mpud::types::int_stat_t
 Interrupt Status. More...
 
typedef uint16_t mpud::types::fifo_config_t
 FIFO configuration, enable sensors to be written to FIFO. More...
 
typedef axes_t< int16_t > mpud::types::raw_axes_t
 Axes type to hold gyroscope, accelerometer, magnetometer raw data. More...
 
typedef axes_t< float > mpud::types::float_axes_t
 Axes type to hold converted sensor data. More...
 
typedef uint8_t mpud::types::mag_stat1_t
 Magnetometer sensor status 1. More...
 
typedef uint8_t mpud::types::mag_stat2_t
 Magnetometer sensor status 2. More...
 
typedef uint8_t mpud::types::selftest_t
 Self-Test results. More...
 

Enumerations

enum  mpud::types::mpu_i2caddr_t { mpud::types::MPU_I2CADDRESS_AD0_LOW = 0x68, mpud::types::MPU_I2CADDRESS_AD0_HIGH = 0x69 }
 MPU's possible I2C slave addresses. More...
 
enum  mpud::types::gyro_fs_t { mpud::types::GYRO_FS_250DPS = 0, mpud::types::GYRO_FS_500DPS = 1, mpud::types::GYRO_FS_1000DPS = 2, mpud::types::GYRO_FS_2000DPS = 3 }
 Gyroscope full-scale range. More...
 
enum  mpud::types::accel_fs_t { mpud::types::ACCEL_FS_2G = 0, mpud::types::ACCEL_FS_4G = 1, mpud::types::ACCEL_FS_8G = 2, mpud::types::ACCEL_FS_16G = 3 }
 Accel full-scale range. More...
 
enum  mpud::types::dlpf_t {
  mpud::types::DLPF_256HZ_NOLPF = 0, mpud::types::DLPF_188HZ = 1, mpud::types::DLPF_98HZ = 2, mpud::types::DLPF_42HZ = 3,
  mpud::types::DLPF_20HZ = 4, mpud::types::DLPF_10HZ = 5, mpud::types::DLPF_5HZ = 6, mpud::types::DLPF_2100HZ_NOLPF
}
 Digital low-pass filter (based on gyro bandwidth) More...
 
enum  mpud::types::clock_src_t {
  mpud::types::CLOCK_INTERNAL = 0, mpud::types::CLOCK_PLL = 3, mpud::types::CLOCK_EXT32KHZ = 4, mpud::types::CLOCK_EXT19MHZ = 5,
  mpud::types::CLOCK_KEEP_RESET = 7
}
 Clock Source. More...
 
enum  mpud::types::fchoice_t { mpud::types::FCHOICE_0 = 0, mpud::types::FCHOICE_1 = 1, mpud::types::FCHOICE_2 = 2, mpud::types::FCHOICE_3 = 3 }
 Fchoice (Frequency choice maybe ?) [MPU6500 and MPU9250 only]. More...
 
enum  mpud::types::lp_accel_rate_t {
  mpud::types::LP_ACCEL_RATE_1_25HZ = 0, mpud::types::LP_ACCEL_RATE_5HZ = 1, mpud::types::LP_ACCEL_RATE_20HZ = 2, mpud::types::LP_ACCEL_RATE_40HZ,
  mpud::types::LP_ACCEL_RATE_0_49HZ = 1, mpud::types::LP_ACCEL_RATE_0_98HZ = 2, mpud::types::LP_ACCEL_RATE_1_95HZ = 3, mpud::types::LP_ACCEL_RATE_3_91HZ = 4,
  mpud::types::LP_ACCEL_RATE_7_81HZ = 5, mpud::types::LP_ACCEL_RATE_15_63HZ = 6, mpud::types::LP_ACCEL_RATE_31_25HZ = 7, mpud::types::LP_ACCEL_RATE_62_50HZ = 8,
  mpud::types::LP_ACCEL_RATE_125HZ = 9, mpud::types::LP_ACCEL_RATE_250HZ = 10, mpud::types::LP_ACCEL_RATE_500HZ
}
 Low-Power Accelerometer wake-up rates. More...
 
enum  mpud::types::accel_dhpf_t {
  mpud::types::ACCEL_DHPF_RESET = 0, mpud::types::ACCEL_DHPF_5HZ = 1, mpud::types::ACCEL_DHPF_2_5HZ = 2, mpud::types::ACCEL_DHPF_1_25HZ = 3,
  mpud::types::ACCEL_DHPF_0_63HZ = 4, mpud::types::ACCEL_DHPF_HOLD = 7
}
 Accelerometer Digital High Pass Filter (only for motion detection modules) More...
 
enum  mpud::types::mot_counter_t { mpud::types::MOT_COUNTER_RESET = 0, mpud::types::MOT_COUNTER_DEC_1 = 1, mpud::types::MOT_COUNTER_DEC_2 = 2, mpud::types::MOT_COUNTER_DEC_4 = 3 }
 Motion Detection counter decrement rate (Motion and FreeFall) More...
 
enum  mpud::types::auxi2c_clock_t {
  mpud::types::AUXI2C_CLOCK_348KHZ = 0, mpud::types::AUXI2C_CLOCK_333KHZ = 1, mpud::types::AUXI2C_CLOCK_320KHZ = 2, mpud::types::AUXI2C_CLOCK_308KHZ = 3,
  mpud::types::AUXI2C_CLOCK_296KHZ = 4, mpud::types::AUXI2C_CLOCK_286KHZ = 5, mpud::types::AUXI2C_CLOCK_276KHZ = 6, mpud::types::AUXI2C_CLOCK_267KHZ = 7,
  mpud::types::AUXI2C_CLOCK_258KHZ = 8, mpud::types::AUXI2C_CLOCK_500KHZ = 9, mpud::types::AUXI2C_CLOCK_471KHZ = 10, mpud::types::AUXI2C_CLOCK_444KHZ = 11,
  mpud::types::AUXI2C_CLOCK_421KHZ = 12, mpud::types::AUXI2C_CLOCK_400KHZ = 13, mpud::types::AUXI2C_CLOCK_381KHZ = 14, mpud::types::AUXI2C_CLOCK_364KHZ = 15
}
 Auxiliary I2C Master clock speed. More...
 
enum  mpud::types::auxi2c_trans_t { mpud::types::AUXI2C_TRANS_RESTART = 0, mpud::types::AUXI2C_TRANS_STOP = 1 }
 Auxiliary I2C Master’s transition from one slave read to the next slave read. More...
 
enum  mpud::types::auxi2c_slv_t { mpud::types::AUXI2C_SLAVE_0 = 0, mpud::types::AUXI2C_SLAVE_1 = 1, mpud::types::AUXI2C_SLAVE_2 = 2, mpud::types::AUXI2C_SLAVE_3 = 3 }
 Auxiliary I2C Slaves slots. More...
 
enum  mpud::types::auxi2c_rw_t { mpud::types::AUXI2C_WRITE = 0, mpud::types::AUXI2C_READ = 1 }
 Auxiliary I2C operation. More...
 
enum  mpud::types::auxi2c_eow_t { mpud::types::AUXI2C_EOW_ODD_NUM = 0, mpud::types::AUXI2C_EOW_EVEN_NUM = 1 }
 Auxiliary I2C, EOW = end of word, use for swap. More...
 
enum  mpud::types::auxvddio_lvl_t { mpud::types::AUXVDDIO_LVL_VLOGIC = 0, mpud::types::AUXVDDIO_LVL_VDD = 1 }
 Auxiliary I2C bus VDDIO level [MPU6050 / MPU9150 only]. More...
 
enum  mpud::types::int_lvl_t { mpud::types::INT_LVL_ACTIVE_HIGH = 0, mpud::types::INT_LVL_ACTIVE_LOW = 1 }
 Interrupt active level. More...
 
enum  mpud::types::int_drive_t { mpud::types::INT_DRV_PUSHPULL = 0, mpud::types::INT_DRV_OPENDRAIN = 1 }
 Interrupt drive state. More...
 
enum  mpud::types::int_mode_t { mpud::types::INT_MODE_PULSE50US = 0, mpud::types::INT_MODE_LATCH = 1 }
 Interrupt mode. More...
 
enum  mpud::types::int_clear_t { mpud::types::INT_CLEAR_STATUS_REG = 0, mpud::types::INT_CLEAR_ANYREAD = 1 }
 Interrupt clear mode. More...
 
enum  mpud::types::fifo_size_t { mpud::types::FIFO_SIZE_512B = 0, mpud::types::FIFO_SIZE_1K = 1, mpud::types::FIFO_SIZE_2K = 2, mpud::types::FIFO_SIZE_4K = 3 }
 MPU6500 Fifo size. More...
 
enum  mpud::types::dmp_int_mode_t { mpud::types::DMP_INT_MODE_PACKET = 0, mpud::types::DMP_INT_MODE_GESTURE = 1 }
 DMP Interrupt mode. More...
 
enum  mpud::types::fifo_mode_t { mpud::types::FIFO_MODE_OVERWRITE = 0, mpud::types::FIFO_MODE_STOP_FULL = 1 }
 FIFO mode. More...
 
enum  mpud::types::mag_mode_t {
  mpud::types::MAG_MODE_POWER_DOWN = 0x0, mpud::types::MAG_MODE_SINGLE_MEASURE = 0x1, mpud::types::MAG_MODE_SELF_TEST = 0x8, mpud::types::MAG_MODE_FUSE_ROM = 0xF,
  mpud::types::MAG_MODE_CONTINUOUS_8HZ = 0x2, mpud::types::MAG_MODE_CONTINUOUS_100HZ = 0x6, mpud::types::MAG_MODE_EXTERNAL_TRIGGER
}
 Magnetometer operation modes. More...
 
enum  mpud::types::mag_sensy_t { mpud::types::MAG_SENSITIVITY_0_6_uT = 0, mpud::types::MAG_SENSITIVITY_0_15_uT = 1 }
 Magnetometer sensitivity. More...
 

Variables

static constexpr mpu_i2caddr_t mpud::types::MPU_DEFAULT_I2CADDRESS = MPU_I2CADDRESS_AD0_LOW
 
static constexpr mpu_bus_t & mpud::types::MPU_DEFAULT_BUS = i2c0
 
static constexpr mpu_addr_handle_t mpud::types::MPU_DEFAULT_ADDR_HANDLE = MPU_DEFAULT_I2CADDRESS
 
static constexpr uint16_t mpud::types::SAMPLE_RATE_MAX = 8000
 
static constexpr mot_stat_t mpud::types::MOT_STAT_XNEG {1 << regs::MOT_STATUS_X_NEG_BIT}
 
static constexpr mot_stat_t mpud::types::MOT_STAT_XPOS {1 << regs::MOT_STATUS_X_POS_BIT}
 
static constexpr mot_stat_t mpud::types::MOT_STAT_YNEG {1 << regs::MOT_STATUS_Y_NEG_BIT}
 
static constexpr mot_stat_t mpud::types::MOT_STAT_YPOS {1 << regs::MOT_STATUS_Y_POS_BIT}
 
static constexpr mot_stat_t mpud::types::MOT_STAT_ZNEG {1 << regs::MOT_STATUS_Z_NEG_BIT}
 
static constexpr mot_stat_t mpud::types::MOT_STAT_ZPOS {1 << regs::MOT_STATUS_Z_POS_BIT}
 
static constexpr mot_stat_t mpud::types::MOT_STAT_ZEROMOTION {1 << regs::MOT_STATUS_ZRMOT_BIT}
 
static constexpr stby_en_t mpud::types::STBY_EN_NONE {0x0}
 
static constexpr stby_en_t mpud::types::STBY_EN_ACCEL_X {1 << regs::PWR2_STBY_XA_BIT}
 
static constexpr stby_en_t mpud::types::STBY_EN_ACCEL_Y {1 << regs::PWR2_STBY_YA_BIT}
 
static constexpr stby_en_t mpud::types::STBY_EN_ACCEL_Z {1 << regs::PWR2_STBY_ZA_BIT}
 
static constexpr stby_en_t mpud::types::STBY_EN_ACCEL {STBY_EN_ACCEL_X | STBY_EN_ACCEL_Y | STBY_EN_ACCEL_Z}
 
static constexpr stby_en_t mpud::types::STBY_EN_GYRO_X {1 << regs::PWR2_STBY_XG_BIT}
 
static constexpr stby_en_t mpud::types::STBY_EN_GYRO_Y {1 << regs::PWR2_STBY_YG_BIT}
 
static constexpr stby_en_t mpud::types::STBY_EN_GYRO_Z {1 << regs::PWR2_STBY_ZG_BIT}
 
static constexpr stby_en_t mpud::types::STBY_EN_GYRO {STBY_EN_GYRO_X | STBY_EN_GYRO_Y | STBY_EN_GYRO_Z}
 
static constexpr stby_en_t mpud::types::STBY_EN_TEMP {1 << 6}
 
static constexpr stby_en_t mpud::types::STBY_EN_LOWPWR_GYRO_PLL_ON {1 << 7}
 This is a low power mode that allows quick enabling of the gyros. More...
 
static constexpr auxi2c_stat_t mpud::types::AUXI2C_STAT_FSYNC {1 << regs::I2CMST_STAT_PASS_THROUGH_BIT}
 
static constexpr auxi2c_stat_t mpud::types::AUXI2C_STAT_LOST_ARB {1 << regs::I2CMST_STAT_LOST_ARB_BIT}
 
static constexpr auxi2c_stat_t mpud::types::AUXI2C_STAT_SLV4_DONE {1 << regs::I2CMST_STAT_SLV4_DONE_BIT}
 
static constexpr auxi2c_stat_t mpud::types::AUXI2C_STAT_SLV4_NACK {1 << regs::I2CMST_STAT_SLV4_NACK_BIT}
 
static constexpr auxi2c_stat_t mpud::types::AUXI2C_STAT_SLV3_NACK {1 << regs::I2CMST_STAT_SLV3_NACK_BIT}
 
static constexpr auxi2c_stat_t mpud::types::AUXI2C_STAT_SLV2_NACK {1 << regs::I2CMST_STAT_SLV2_NACK_BIT}
 
static constexpr auxi2c_stat_t mpud::types::AUXI2C_STAT_SLV1_NACK {1 << regs::I2CMST_STAT_SLV1_NACK_BIT}
 
static constexpr auxi2c_stat_t mpud::types::AUXI2C_STAT_SLV0_NACK {1 << regs::I2CMST_STAT_SLV0_NACK_BIT}
 
static constexpr int_en_t mpud::types::INT_EN_NONE {0x0}
 
static constexpr int_en_t mpud::types::INT_EN_MOTION_DETECT {1 << regs::INT_ENABLE_MOTION_BIT}
 
static constexpr int_en_t mpud::types::INT_EN_FIFO_OVERFLOW {1 << regs::INT_ENABLE_FIFO_OFLOW_BIT}
 
static constexpr int_en_t mpud::types::INT_EN_I2C_MST_FSYNC {1 << regs::INT_ENABLE_I2C_MST_FSYNC_BIT}
 
static constexpr int_en_t mpud::types::INT_EN_PLL_READY {1 << regs::INT_ENABLE_PLL_RDY_BIT}
 
static constexpr int_en_t mpud::types::INT_EN_DMP_READY {1 << regs::INT_ENABLE_DMP_RDY_BIT}
 
static constexpr int_en_t mpud::types::INT_EN_RAWDATA_READY {1 << regs::INT_ENABLE_RAW_DATA_RDY_BIT}
 
static constexpr int_en_t mpud::types::INT_EN_FREE_FALL {1 << regs::INT_ENABLE_FREEFALL_BIT}
 
static constexpr int_en_t mpud::types::INT_EN_ZERO_MOTION {1 << regs::INT_ENABLE_ZEROMOT_BIT}
 
static constexpr int_stat_t mpud::types::INT_STAT_MOTION_DETECT {1 << regs::INT_STATUS_MOTION_BIT}
 
static constexpr int_stat_t mpud::types::INT_STAT_FIFO_OVERFLOW {1 << regs::INT_STATUS_FIFO_OFLOW_BIT}
 
static constexpr int_stat_t mpud::types::INT_STAT_I2C_MST_FSYNC {1 << regs::INT_STATUS_I2C_MST_BIT}
 
static constexpr int_stat_t mpud::types::INT_STAT_PLL_READY {1 << regs::INT_STATUS_PLL_RDY_BIT}
 
static constexpr int_stat_t mpud::types::INT_STAT_DMP_READY {1 << regs::INT_STATUS_DMP_RDY_BIT}
 
static constexpr int_stat_t mpud::types::INT_STAT_RAWDATA_READY {1 << regs::INT_STATUS_RAW_DATA_RDY_BIT}
 
static constexpr int_stat_t mpud::types::INT_STAT_FREE_FALL {1 << regs::INT_STATUS_FREEFALL_BIT}
 
static constexpr int_stat_t mpud::types::INT_STAT_ZERO_MOTION {1 << regs::INT_STATUS_ZEROMOT_BIT}
 
static constexpr fifo_config_t mpud::types::FIFO_CFG_NONE {0x0}
 
static constexpr fifo_config_t mpud::types::FIFO_CFG_GYRO
 
static constexpr fifo_config_t mpud::types::FIFO_CFG_ACCEL {1 << regs::FIFO_ACCEL_EN_BIT}
 
static constexpr fifo_config_t mpud::types::FIFO_CFG_TEMPERATURE {1 << regs::FIFO_TEMP_EN_BIT}
 
static constexpr fifo_config_t mpud::types::FIFO_CFG_SLAVE0 {1 << regs::FIFO_SLV_0_EN_BIT}
 
static constexpr fifo_config_t mpud::types::FIFO_CFG_SLAVE1 {1 << regs::FIFO_SLV_1_EN_BIT}
 
static constexpr fifo_config_t mpud::types::FIFO_CFG_SLAVE2 {1 << regs::FIFO_SLV_2_EN_BIT}
 
static constexpr fifo_config_t mpud::types::FIFO_CFG_SLAVE3 {1 << 8}
 
static constexpr fifo_config_t mpud::types::FIFO_CFG_COMPASS {FIFO_CFG_SLAVE0}
 
static constexpr uint8_t mpud::types::COMPASS_I2CADDRESS = 0xC
 
static constexpr uint8_t mpud::types::COMPASS_SAMPLE_RATE_MAX = 100
 
static constexpr mag_stat1_t mpud::types::MAG_STAT1_DATA_RDY {1 << regs::mag::STATUS1_DATA_RDY_BIT}
 
static constexpr mag_stat1_t mpud::types::MAG_STAT1_DATA_OVERRUN {1 << regs::mag::STATUS1_DATA_OVERRUN_BIT}
 
static constexpr mag_stat2_t mpud::types::MAG_STAT2_SENSOR_OVERFLOW {1 << regs::mag::STATUS2_OVERFLOW_BIT}
 
static constexpr mag_stat2_t mpud::types::MAG_STAT2_BIT_OUTPUT_SETTING {1 << regs::mag::STATUS2_BIT_OUTPUT_M_BIT}
 
static constexpr mag_stat2_t mpud::types::MAG_STAT2_DATA_ERROR {1 << regs::mag::STATUS2_DATA_ERROR_BIT}
 
static constexpr auxi2c_slv_t mpud::types::MAG_SLAVE_READ_DATA = AUXI2C_SLAVE_0
 
static constexpr auxi2c_slv_t mpud::types::MAG_SLAVE_CHG_MODE = AUXI2C_SLAVE_1
 
static constexpr uint8_t mpud::types::MAG_DATA_LENGTH = 8
 
static constexpr selftest_t mpud::types::SELF_TEST_PASS {0x0}
 
static constexpr selftest_t mpud::types::SELF_TEST_GYRO_FAIL {1 << 0}
 
static constexpr selftest_t mpud::types::SELF_TEST_ACCEL_FAIL {1 << 1}
 

Detailed Description

Declare Types and Definitions used within mpud namespace.