dRonin
adbada4
dRonin firmware
|
Common driver for Invensense MPU-xxx0 6/9-axis IMUs. More...
Data Structures | |
struct | pios_mpu_cfg |
Typedefs | |
typedef struct pios_mpu_dev * | pios_mpu_dev_t |
Functions | |
int32_t | PIOS_MPU_I2C_Init (pios_mpu_dev_t *dev, pios_i2c_t i2c_id, const struct pios_mpu_cfg *cfg) |
Initialize the MPU-xxxx 6/9-axis sensor on I2C. More... | |
int32_t | PIOS_MPU_SPI_Init (pios_mpu_dev_t *dev, pios_spi_t spi_id, uint32_t slave_num, const struct pios_mpu_cfg *cfg) |
Initialize the MPU-xxxx 6/9-axis sensor on SPI. More... | |
int32_t | PIOS_MPU_Test () |
int32_t | PIOS_MPU_SetGyroRange (enum pios_mpu_gyro_range range) |
int32_t | PIOS_MPU_SetAccelRange (enum pios_mpu_accel_range range) |
int32_t | PIOS_MPU_SetSampleRate (uint16_t samplerate_hz) |
void | PIOS_MPU_SetGyroBandwidth (uint16_t bandwidth) |
Sets the bandwidth desired from the gyro. The driver will automatically select the lowest bandwidth low-pass filter capable of providing the desired bandwidth. More... | |
void | PIOS_MPU_SetAccelBandwidth (uint16_t bandwidth) |
Sets the bandwidth desired from the accelerometer. The driver will automatically select the lowest bandwidth low-pass filter capable of providing the desired bandwidth. More... | |
bool | PIOS_MPU_IRQHandler (void) |
The IMU interrupt handler. Fetches new data from the IMU. More... | |
enum pios_mpu_type | PIOS_MPU_GetType (void) |
Which type of MPU was detected? More... | |
Common driver for Invensense MPU-xxx0 6/9-axis IMUs.
Common driver for Invensense MPU-xxx0 6/9-axis IMUs. Private Declarations.
Common driver for Invensense MPU-xxx0 6/9-axis IMUs. Public Interface.
#define PIOS_MPU_ACCEL_CFG2_REG 0X1D |
Definition at line 40 of file pios_mpu_priv.h.
#define PIOS_MPU_ACCEL_CFG_REG 0X1C |
Definition at line 39 of file pios_mpu_priv.h.
#define PIOS_MPU_ACCEL_OUT 0x08 |
Definition at line 86 of file pios_mpu_priv.h.
#define PIOS_MPU_ACCEL_X_OUT_LSB 0x3C |
Definition at line 59 of file pios_mpu_priv.h.
#define PIOS_MPU_ACCEL_X_OUT_MSB 0x3B |
Definition at line 58 of file pios_mpu_priv.h.
#define PIOS_MPU_ACCEL_Y_OUT_LSB 0x3E |
Definition at line 61 of file pios_mpu_priv.h.
#define PIOS_MPU_ACCEL_Y_OUT_MSB 0x3D |
Definition at line 60 of file pios_mpu_priv.h.
#define PIOS_MPU_ACCEL_Z_OUT_LSB 0x40 |
Definition at line 63 of file pios_mpu_priv.h.
#define PIOS_MPU_ACCEL_Z_OUT_MSB 0x3F |
Definition at line 62 of file pios_mpu_priv.h.
#define PIOS_MPU_AK8963_CNTL2_REG 0x0B |
Definition at line 146 of file pios_mpu_priv.h.
#define PIOS_MPU_AK8963_CNTL2_SRST 0x01 |
Definition at line 147 of file pios_mpu_priv.h.
#define PIOS_MPU_AK8963_MODE_CONTINUOUS_FAST_16B 0x16 |
Definition at line 148 of file pios_mpu_priv.h.
#define PIOS_MPU_AK8963_ST2_BITM 0x10 |
Definition at line 142 of file pios_mpu_priv.h.
#define PIOS_MPU_AK8975_MODE_SINGLE_12B 0x01 |
Definition at line 149 of file pios_mpu_priv.h.
#define PIOS_MPU_AK8975_ST2_DERR 0x04 |
Definition at line 144 of file pios_mpu_priv.h.
#define PIOS_MPU_AK89XX_ADDR 0x0C |
Definition at line 136 of file pios_mpu_priv.h.
#define PIOS_MPU_AK89XX_CNTL1_REG 0x0A |
Definition at line 145 of file pios_mpu_priv.h.
#define PIOS_MPU_AK89XX_ST1_DRDY 0x01 |
Definition at line 141 of file pios_mpu_priv.h.
#define PIOS_MPU_AK89XX_ST1_REG 0x02 |
Definition at line 139 of file pios_mpu_priv.h.
#define PIOS_MPU_AK89XX_ST2_HOFL 0x08 |
Definition at line 143 of file pios_mpu_priv.h.
#define PIOS_MPU_AK89XX_ST2_REG 0x09 |
Definition at line 140 of file pios_mpu_priv.h.
#define PIOS_MPU_AK89XX_WHOAMI_ID 0x48 |
Definition at line 138 of file pios_mpu_priv.h.
#define PIOS_MPU_AK89XX_WHOAMI_REG 0x00 |
Definition at line 137 of file pios_mpu_priv.h.
#define PIOS_MPU_DLPF_CFG_REG 0X1A |
Definition at line 37 of file pios_mpu_priv.h.
#define PIOS_MPU_FIFO_CNT_LSB 0x73 |
Definition at line 77 of file pios_mpu_priv.h.
#define PIOS_MPU_FIFO_CNT_MSB 0x72 |
Definition at line 76 of file pios_mpu_priv.h.
#define PIOS_MPU_FIFO_EN_REG 0x23 |
Definition at line 41 of file pios_mpu_priv.h.
#define PIOS_MPU_FIFO_GYRO_X_OUT 0x40 |
Definition at line 83 of file pios_mpu_priv.h.
#define PIOS_MPU_FIFO_GYRO_Y_OUT 0x20 |
Definition at line 84 of file pios_mpu_priv.h.
#define PIOS_MPU_FIFO_GYRO_Z_OUT 0x10 |
Definition at line 85 of file pios_mpu_priv.h.
#define PIOS_MPU_FIFO_REG 0x74 |
Definition at line 78 of file pios_mpu_priv.h.
#define PIOS_MPU_FIFO_TEMP_OUT 0x80 |
Definition at line 82 of file pios_mpu_priv.h.
#define PIOS_MPU_GYRO_CFG_REG 0X1B |
Definition at line 38 of file pios_mpu_priv.h.
#define PIOS_MPU_GYRO_X_OUT_LSB 0x44 |
Definition at line 67 of file pios_mpu_priv.h.
#define PIOS_MPU_GYRO_X_OUT_MSB 0x43 |
Definition at line 66 of file pios_mpu_priv.h.
#define PIOS_MPU_GYRO_Y_OUT_LSB 0x46 |
Definition at line 69 of file pios_mpu_priv.h.
#define PIOS_MPU_GYRO_Y_OUT_MSB 0x45 |
Definition at line 68 of file pios_mpu_priv.h.
#define PIOS_MPU_GYRO_Z_OUT_LSB 0x48 |
Definition at line 71 of file pios_mpu_priv.h.
#define PIOS_MPU_GYRO_Z_OUT_MSB 0x47 |
Definition at line 70 of file pios_mpu_priv.h.
#define PIOS_MPU_I2C_MST_DELAY_CTRL 0x67 |
Definition at line 72 of file pios_mpu_priv.h.
#define PIOS_MPU_I2C_MST_LOST_ARB 0x20 |
Definition at line 120 of file pios_mpu_priv.h.
#define PIOS_MPU_I2C_MST_SLV0_NACK 0x01 |
Definition at line 122 of file pios_mpu_priv.h.
#define PIOS_MPU_I2C_MST_SLV4_DONE 0x40 |
Definition at line 119 of file pios_mpu_priv.h.
#define PIOS_MPU_I2C_MST_SLV4_NACK 0x10 |
Definition at line 121 of file pios_mpu_priv.h.
#define PIOS_MPU_I2C_MST_STATUS_REG 0x36 |
Definition at line 54 of file pios_mpu_priv.h.
#define PIOS_MPU_I2CMSTDELAY_ESSHADOW 0x80 |
Definition at line 133 of file pios_mpu_priv.h.
#define PIOS_MPU_I2CMSTDELAY_SLV0EN 0x01 |
Definition at line 131 of file pios_mpu_priv.h.
#define PIOS_MPU_I2CMSTDELAY_SLV1EN 0x02 |
Definition at line 132 of file pios_mpu_priv.h.
#define PIOS_MPU_I2CSLV_BYTE_SW 0x40 |
Definition at line 126 of file pios_mpu_priv.h.
#define PIOS_MPU_I2CSLV_EN 0x80 |
Definition at line 125 of file pios_mpu_priv.h.
#define PIOS_MPU_I2CSLV_GRP 0x10 |
Definition at line 128 of file pios_mpu_priv.h.
#define PIOS_MPU_I2CSLV_REG_DIS 0x20 |
Definition at line 127 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_ACTL 0x80 |
Definition at line 89 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_CFG_REG 0x37 |
Definition at line 55 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_CLR_ANYRD 0x10 |
Definition at line 92 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_EN_REG 0x38 |
Definition at line 56 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_I2C_BYPASS_EN 0x02 |
Definition at line 93 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_LATCH_EN 0x20 |
Definition at line 91 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_OPEN 0x40 |
Definition at line 90 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_STATUS_DATA_RDY 0X01 |
Definition at line 101 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_STATUS_IMU_RDY 0X04 |
Definition at line 100 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_STATUS_OVERFLOW 0x10 |
Definition at line 99 of file pios_mpu_priv.h.
#define PIOS_MPU_INT_STATUS_REG 0x3A |
Definition at line 57 of file pios_mpu_priv.h.
#define PIOS_MPU_INTEN_DATA_RDY 0x01 |
Definition at line 96 of file pios_mpu_priv.h.
#define PIOS_MPU_INTEN_OVERFLOW 0x10 |
Definition at line 95 of file pios_mpu_priv.h.
#define PIOS_MPU_PRODUCT_ID 0x0C |
Definition at line 35 of file pios_mpu_priv.h.
#define PIOS_MPU_PWR_MGMT_REG 0x6B |
Definition at line 75 of file pios_mpu_priv.h.
#define PIOS_MPU_PWRMGMT_IMU_RST 0X80 |
Definition at line 111 of file pios_mpu_priv.h.
#define PIOS_MPU_PWRMGMT_INTERN_CLK 0X00 |
Definition at line 112 of file pios_mpu_priv.h.
#define PIOS_MPU_PWRMGMT_PLL_X_CLK 0X01 |
Definition at line 113 of file pios_mpu_priv.h.
#define PIOS_MPU_PWRMGMT_PLL_Y_CLK 0X02 |
Definition at line 114 of file pios_mpu_priv.h.
#define PIOS_MPU_PWRMGMT_PLL_Z_CLK 0X03 |
Definition at line 115 of file pios_mpu_priv.h.
#define PIOS_MPU_PWRMGMT_STOP_CLK 0X07 |
Definition at line 116 of file pios_mpu_priv.h.
#define PIOS_MPU_SIGNAL_PATH_RESET 0x68 |
Definition at line 73 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV0_ADDR_REG 0x25 |
Definition at line 42 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV0_CTRL_REG 0x27 |
Definition at line 44 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV0_REG_REG 0x26 |
Definition at line 43 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV1_ADDR_REG 0x28 |
Definition at line 45 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV1_CTRL_REG 0x2A |
Definition at line 48 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV1_DO_REG 0x64 |
Definition at line 47 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV1_REG_REG 0x29 |
Definition at line 46 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV4_ADDR_REG 0x31 |
Definition at line 49 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV4_CTRL_REG 0x34 |
Definition at line 52 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV4_DI_REG 0x35 |
Definition at line 53 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV4_DO_REG 0x33 |
Definition at line 51 of file pios_mpu_priv.h.
#define PIOS_MPU_SLV4_REG_REG 0x32 |
Definition at line 50 of file pios_mpu_priv.h.
#define PIOS_MPU_SMPLRT_DIV_REG 0X19 |
Definition at line 36 of file pios_mpu_priv.h.
#define PIOS_MPU_TEMP_OUT_LSB 0x42 |
Definition at line 65 of file pios_mpu_priv.h.
#define PIOS_MPU_TEMP_OUT_MSB 0x41 |
Definition at line 64 of file pios_mpu_priv.h.
#define PIOS_MPU_USER_CTRL_REG 0x6A |
Definition at line 74 of file pios_mpu_priv.h.
#define PIOS_MPU_USERCTL_DIS_I2C 0X10 |
Definition at line 106 of file pios_mpu_priv.h.
#define PIOS_MPU_USERCTL_FIFO_EN 0X40 |
Definition at line 104 of file pios_mpu_priv.h.
#define PIOS_MPU_USERCTL_FIFO_RST 0X02 |
Definition at line 107 of file pios_mpu_priv.h.
#define PIOS_MPU_USERCTL_GYRO_RST 0X01 |
Definition at line 108 of file pios_mpu_priv.h.
#define PIOS_MPU_USERCTL_I2C_MST_EN 0X20 |
Definition at line 105 of file pios_mpu_priv.h.
#define PIOS_MPU_WHOAMI 0x75 |
Definition at line 79 of file pios_mpu_priv.h.
typedef struct pios_mpu_dev* pios_mpu_dev_t |
Definition at line 150 of file pios_mpu.h.
Definition at line 104 of file pios_mpu.h.
Definition at line 83 of file pios_mpu.h.
Definition at line 63 of file pios_mpu.h.
Definition at line 94 of file pios_mpu.h.
Definition at line 73 of file pios_mpu.h.
enum pios_mpu_accel_range |
Enumerator | |
---|---|
PIOS_MPU_SCALE_2G | |
PIOS_MPU_SCALE_4G | |
PIOS_MPU_SCALE_8G | |
PIOS_MPU_SCALE_16G |
Definition at line 121 of file pios_mpu.h.
enum pios_mpu_error |
MPU driver error return types
Definition at line 37 of file pios_mpu.h.
enum pios_mpu_gyro_range |
Enumerator | |
---|---|
PIOS_MPU_SCALE_250_DEG | |
PIOS_MPU_SCALE_500_DEG | |
PIOS_MPU_SCALE_1000_DEG | |
PIOS_MPU_SCALE_2000_DEG |
Definition at line 114 of file pios_mpu.h.
enum pios_mpu_orientation |
Enumerator | |
---|---|
PIOS_MPU_TOP_0DEG | |
PIOS_MPU_TOP_90DEG | |
PIOS_MPU_TOP_180DEG | |
PIOS_MPU_TOP_270DEG | |
PIOS_MPU_BOTTOM_0DEG | |
PIOS_MPU_BOTTOM_90DEG | |
PIOS_MPU_BOTTOM_180DEG | |
PIOS_MPU_BOTTOM_270DEG |
Definition at line 128 of file pios_mpu.h.
enum pios_mpu_type |
Supported IMU devices
Definition at line 52 of file pios_mpu.h.
enum pios_mpu_type PIOS_MPU_GetType | ( | void | ) |
Which type of MPU was detected?
int32_t PIOS_MPU_I2C_Init | ( | pios_mpu_dev_t * | dev, |
pios_i2c_t | i2c_id, | ||
const struct pios_mpu_cfg * | cfg | ||
) |
Initialize the MPU-xxxx 6/9-axis sensor on I2C.
[in] | i2c_id | PiOS I2C driver instance ID/pointer |
[in] | cfg | MPU config |
bool PIOS_MPU_IRQHandler | ( | void | ) |
The IMU interrupt handler. Fetches new data from the IMU.
void PIOS_MPU_SetAccelBandwidth | ( | uint16_t | bandwidth | ) |
Sets the bandwidth desired from the accelerometer. The driver will automatically select the lowest bandwidth low-pass filter capable of providing the desired bandwidth.
[in] | bandwidth | The desired bandwidth [Hz] |
int32_t PIOS_MPU_SetAccelRange | ( | enum pios_mpu_accel_range | range | ) |
void PIOS_MPU_SetGyroBandwidth | ( | uint16_t | bandwidth | ) |
Sets the bandwidth desired from the gyro. The driver will automatically select the lowest bandwidth low-pass filter capable of providing the desired bandwidth.
[in] | bandwidth | The desired bandwidth [Hz] |
int32_t PIOS_MPU_SetGyroRange | ( | enum pios_mpu_gyro_range | range | ) |
int32_t PIOS_MPU_SetSampleRate | ( | uint16_t | samplerate_hz | ) |
Set the sample rate in Hz by determining the nearest divisor
[in] | sample | rate in Hz |
int32_t PIOS_MPU_SPI_Init | ( | pios_mpu_dev_t * | dev, |
pios_spi_t | spi_id, | ||
uint32_t | slave_num, | ||
const struct pios_mpu_cfg * | cfg | ||
) |
Initialize the MPU-xxxx 6/9-axis sensor on SPI.
int32_t PIOS_MPU_Test | ( | ) |