dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_mpu.h File Reference
#include "pios.h"

Go to the source code of this file.

Data Structures

struct  pios_mpu_cfg
 

Typedefs

typedef struct pios_mpu_dev * pios_mpu_dev_t
 

Enumerations

enum  pios_mpu_error {
  PIOS_MPU_ERROR_NONE = 0, PIOS_MPU_ERROR_NOCONFIG = 1, PIOS_MPU_ERROR_PROBEFAILED, PIOS_MPU_ERROR_WRITEFAILED,
  PIOS_MPU_ERROR_READFAILED, PIOS_MPU_ERROR_NOIRQ, PIOS_MPU_ERROR_SAMPLERATE, PIOS_MPU_ERROR_WHOAMI,
  PIOS_MPU_ERROR_MAGFAILED
}
 
enum  pios_mpu_type {
  PIOS_MPU60X0, PIOS_MPU6500, PIOS_MPU9150, PIOS_MPU9250,
  PIOS_ICM20608G, PIOS_ICM20602, PIOS_ICM20689, PIOS_MPU_NUM
}
 
enum  pios_mpu60x0_gyro_filter {
  PIOS_MPU60X0_GYRO_LOWPASS_256_HZ = 0x00, PIOS_MPU60X0_GYRO_LOWPASS_188_HZ = 0x01, PIOS_MPU60X0_GYRO_LOWPASS_98_HZ = 0x02, PIOS_MPU60X0_GYRO_LOWPASS_42_HZ = 0x03,
  PIOS_MPU60X0_GYRO_LOWPASS_20_HZ = 0x04, PIOS_MPU60X0_GYRO_LOWPASS_10_HZ = 0x05, PIOS_MPU60X0_GYRO_LOWPASS_5_HZ = 0x06
}
 
enum  pios_mpu6500_gyro_filter {
  PIOS_MPU6500_GYRO_LOWPASS_250_HZ = 0x00, PIOS_MPU6500_GYRO_LOWPASS_184_HZ = 0x01, PIOS_MPU6500_GYRO_LOWPASS_92_HZ = 0x02, PIOS_MPU6500_GYRO_LOWPASS_41_HZ = 0x03,
  PIOS_MPU6500_GYRO_LOWPASS_20_HZ = 0x04, PIOS_MPU6500_GYRO_LOWPASS_10_HZ = 0x05, PIOS_MPU6500_GYRO_LOWPASS_5_HZ = 0x06
}
 
enum  pios_icm206xx_gyro_filter {
  PIOS_ICM206XX_GYRO_LOWPASS_250_HZ = 0x00, PIOS_ICM206XX_GYRO_LOWPASS_176_HZ = 0x01, PIOS_ICM206XX_GYRO_LOWPASS_92_HZ = 0x02, PIOS_ICM206XX_GYRO_LOWPASS_41_HZ = 0x03,
  PIOS_ICM206XX_GYRO_LOWPASS_20_HZ = 0x04, PIOS_ICM206XX_GYRO_LOWPASS_10_HZ = 0x05, PIOS_ICM206XX_GYRO_LOWPASS_5_HZ = 0x06, PIOS_ICM206XX_GYRO_LOWPASS_3281_HZ = 0x07
}
 
enum  pios_mpu6500_accel_filter {
  PIOS_MPU6500_ACCEL_LOWPASS_460_HZ = 0x00, PIOS_MPU6500_ACCEL_LOWPASS_184_HZ = 0x01, PIOS_MPU6500_ACCEL_LOWPASS_92_HZ = 0x02, PIOS_MPU6500_ACCEL_LOWPASS_41_HZ = 0x03,
  PIOS_MPU6500_ACCEL_LOWPASS_20_HZ = 0x04, PIOS_MPU6500_ACCEL_LOWPASS_10_HZ = 0x05, PIOS_MPU6500_ACCEL_LOWPASS_5_HZ = 0x06
}
 
enum  pios_icm206xx_accel_filter {
  PIOS_ICM206XX_ACCEL_LOWPASS_218_HZ = 0x00, PIOS_ICM206XX_ACCEL_LOWPASS_99_HZ = 0x02, PIOS_ICM206XX_ACCEL_LOWPASS_45_HZ = 0x03, PIOS_ICM206XX_ACCEL_LOWPASS_21_HZ = 0x04,
  PIOS_ICM206XX_ACCEL_LOWPASS_10_HZ = 0x05, PIOS_ICM206XX_ACCEL_LOWPASS_5_HZ = 0x06, PIOS_ICM206XX_ACCEL_LOWPASS_420_HZ = 0x07
}
 
enum  pios_mpu_gyro_range { PIOS_MPU_SCALE_250_DEG = 0x00, PIOS_MPU_SCALE_500_DEG = 0x08, PIOS_MPU_SCALE_1000_DEG = 0x10, PIOS_MPU_SCALE_2000_DEG = 0x18 }
 
enum  pios_mpu_accel_range { PIOS_MPU_SCALE_2G = 0x00, PIOS_MPU_SCALE_4G = 0x08, PIOS_MPU_SCALE_8G = 0x10, PIOS_MPU_SCALE_16G = 0x18 }
 
enum  pios_mpu_orientation {
  PIOS_MPU_TOP_0DEG = 0x00, PIOS_MPU_TOP_90DEG = 0x01, PIOS_MPU_TOP_180DEG = 0x02, PIOS_MPU_TOP_270DEG = 0x03,
  PIOS_MPU_BOTTOM_0DEG = 0x04, PIOS_MPU_BOTTOM_90DEG = 0x05, PIOS_MPU_BOTTOM_180DEG = 0x06, PIOS_MPU_BOTTOM_270DEG = 0x07
}
 

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...