32 #include "generated/modules.h"
33 #if IMU_MPU_USE_MEDIAN_FILTER
38 PRINT_CONFIG_VAR(IMU_MPU_SPI_SLAVE_IDX)
39 PRINT_CONFIG_VAR(IMU_MPU_SPI_DEV)
42 #if !defined IMU_MPU_LOWPASS_FILTER && !defined IMU_MPU_SMPLRT_DIV
43 #if (PERIODIC_FREQUENCY >= 60) && (PERIODIC_FREQUENCY <= 120)
47 #define IMU_MPU_LOWPASS_FILTER MPU60X0_DLPF_42HZ
48 #define IMU_MPU_SMPLRT_DIV 9
49 PRINT_CONFIG_MSG(
"Gyro/Accel output rate is 100Hz at 1kHz internal sampling")
50 #ifndef IMU_MPU_ACCEL_LOWPASS_FILTER
51 #define IMU_MPU_ACCEL_LOWPASS_FILTER MPU60X0_DLPF_ACC_44HZ
53 #elif (PERIODIC_FREQUENCY == 512) || (PERIODIC_FREQUENCY == 500)
57 #define IMU_MPU_LOWPASS_FILTER MPU60X0_DLPF_256HZ
58 #define IMU_MPU_SMPLRT_DIV 3
60 #ifndef IMU_MPU_ACCEL_LOWPASS_FILTER
61 #define IMU_MPU_ACCEL_LOWPASS_FILTER MPU60X0_DLPF_ACC_218HZ
65 #define IMU_MPU_LOWPASS_FILTER MPU60X0_DLPF_42HZ
66 #define IMU_MPU_SMPLRT_DIV 9
67 PRINT_CONFIG_MSG(
"Gyro/Accel output rate is 100Hz at 1kHz internal sampling")
68 #ifndef IMU_MPU_ACCEL_LOWPASS_FILTER
69 #define IMU_MPU_ACCEL_LOWPASS_FILTER MPU60X0_DLPF_ACC_44HZ
71 #warning "Non-default PERIODIC_FREQUENCY: please define IMU_MPU_LOWPASS_FILTER and IMU_MPU_SMPLRT_DIV."
82 #ifndef IMU_MPU_CHAN_X
83 #define IMU_MPU_CHAN_X 0
86 #ifndef IMU_MPU_CHAN_Y
87 #define IMU_MPU_CHAN_Y 1
90 #ifndef IMU_MPU_CHAN_Z
91 #define IMU_MPU_CHAN_Z 2
96 #ifndef IMU_MPU_X_SIGN
97 #define IMU_MPU_X_SIGN 1
100 #ifndef IMU_MPU_Y_SIGN
101 #define IMU_MPU_Y_SIGN 1
104 #ifndef IMU_MPU_Z_SIGN
105 #define IMU_MPU_Z_SIGN 1
111 #if IMU_MPU_USE_MEDIAN_FILTER
119 #if IMU_MPU_USE_MEDIAN_FILTER
161 #if IMU_MPU_USE_MEDIAN_FILTER
Main include for ABI (AirBorneInterface).
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
void imu_set_defaults_accel(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Vect3 *neutral, const struct Int32Vect3 *scale)
Set the defaults for a accel sensor WARNING: Should be called before sensor is publishing messages to...
void imu_set_defaults_gyro(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Rates *neutral, const struct Int32Rates *scale)
Set the defaults for a gyro sensor WARNING: Should be called before sensor is publishing messages to ...
Inertial Measurement Unit interface.
struct ImuMpu6000 imu_mpu_spi
#define IMU_MPU_LOWPASS_FILTER
#define IMU_MPU_SMPLRT_DIV
void imu_mpu_spi_periodic(void)
#define IMU_MPU_ACCEL_LOWPASS_FILTER
void imu_mpu_spi_init(void)
void imu_mpu_spi_event(void)
Driver for IMU with only MPU6000 via SPI.
#define IMU_MPU_GYRO_RANGE
#define IMU_MPU_ACCEL_RANGE
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
const struct Int32Rates MPU60X0_GYRO_SENS_FRAC[4][2]
const struct Int32Vect3 MPU60X0_ACCEL_SENS_FRAC[4][2]
uint8_t smplrt_div
Sample rate divider.
enum Mpu60x0DLPF dlpf_cfg
Digital Low Pass Filter.
enum Mpu60x0AccelRanges accel_range
g Range
enum Mpu60x0ACCDLPF dlpf_cfg_acc
Digital Low Pass Filter for acceleremoter (ICM devices only)
enum Mpu60x0GyroRanges gyro_range
deg/s Range
void mpu60x0_spi_event(struct Mpu60x0_Spi *mpu)
void mpu60x0_spi_init(struct Mpu60x0_Spi *mpu, struct spi_periph *spi_p, uint8_t slave_idx)
volatile bool data_available
data ready flag
struct Mpu60x0Config config
float temp
temperature in degrees Celcius
union Mpu60x0_Spi::@342 data_rates
static void mpu60x0_spi_periodic(struct Mpu60x0_Spi *mpu)
convenience function: read or start configuration if not already initialized
union Mpu60x0_Spi::@341 data_accel
Architecture independent SPI (Serial Peripheral Interface) API.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.