33 #include "generated/modules.h"
35 #if !defined IMU_MPU9250_GYRO_LOWPASS_FILTER && !defined IMU_MPU9250_ACCEL_LOWPASS_FILTER && !defined IMU_MPU9250_SMPLRT_DIV
36 #if (PERIODIC_FREQUENCY >= 60) && (PERIODIC_FREQUENCY <= 120)
41 #define IMU_MPU9250_GYRO_LOWPASS_FILTER MPU9250_DLPF_GYRO_41HZ
42 #define IMU_MPU9250_ACCEL_LOWPASS_FILTER MPU9250_DLPF_ACCEL_41HZ
43 #define IMU_MPU9250_SMPLRT_DIV 9
44 PRINT_CONFIG_MSG(
"Gyro/Accel output rate is 100Hz at 1kHz internal sampling")
45 #elif (PERIODIC_FREQUENCY == 512) || (PERIODIC_FREQUENCY == 500)
50 #define IMU_MPU9250_GYRO_LOWPASS_FILTER MPU9250_DLPF_GYRO_250HZ
51 #define IMU_MPU9250_ACCEL_LOWPASS_FILTER MPU9250_DLPF_ACCEL_184HZ
52 #define IMU_MPU9250_SMPLRT_DIV 3
56 #define IMU_MPU9250_SMPLRT_DIV 9
57 #define IMU_MPU9250_GYRO_LOWPASS_FILTER MPU9250_DLPF_GYRO_41HZ
58 #define IMU_MPU9250_ACCEL_LOWPASS_FILTER MPU9250_DLPF_ACCEL_41HZ
59 PRINT_CONFIG_MSG(
"Gyro/Accel output rate is 100Hz at 1kHz internal sampling")
60 #warning "Non-default PERIODIC_FREQUENCY: please define IMU_MPU9250_GYRO_LOWPASS_FILTER, IMU_MPU9250_ACCEL_LOWPASS_FILTER and IMU_MPU9250_SMPLRT_DIV."
70 #ifndef IMU_MPU9250_I2C_ADDR
71 #define IMU_MPU9250_I2C_ADDR MPU9250_ADDR_ALT
76 #ifndef IMU_MPU9250_CHAN_X
77 #define IMU_MPU9250_CHAN_X 0
80 #ifndef IMU_MPU9250_CHAN_Y
81 #define IMU_MPU9250_CHAN_Y 1
84 #ifndef IMU_MPU9250_CHAN_Z
85 #define IMU_MPU9250_CHAN_Z 2
89 #ifndef IMU_MPU9250_X_SIGN
90 #define IMU_MPU9250_X_SIGN 1
93 #ifndef IMU_MPU9250_Y_SIGN
94 #define IMU_MPU9250_Y_SIGN 1
97 #ifndef IMU_MPU9250_Z_SIGN
98 #define IMU_MPU9250_Z_SIGN 1
147 AbiSendMsgIMU_GYRO_RAW(
IMU_MPU9250_ID, now_ts, &rates, 1, IMU_MPU9250_PERIODIC_FREQ, NAN);
148 AbiSendMsgIMU_ACCEL_RAW(
IMU_MPU9250_ID, now_ts, &accel, 1, IMU_MPU9250_PERIODIC_FREQ, NAN);
150 #if IMU_MPU9250_READ_MAG
Main include for ABI (AirBorneInterface).
volatile bool data_available
data ready flag
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
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.
#define IMU_MPU9250_GYRO_LOWPASS_FILTER
#define IMU_MPU9250_X_SIGN
#define IMU_MPU9250_CHAN_X
void imu_mpu9250_periodic(void)
#define IMU_MPU9250_Y_SIGN
#define IMU_MPU9250_ACCEL_LOWPASS_FILTER
void imu_mpu9250_init(void)
#define IMU_MPU9250_Z_SIGN
#define IMU_MPU9250_SMPLRT_DIV
#define IMU_MPU9250_I2C_ADDR
#define IMU_MPU9250_CHAN_Z
#define IMU_MPU9250_CHAN_Y
struct ImuMpu9250 imu_mpu9250
void imu_mpu9250_event(void)
IMU driver for the MPU9250 using I2C.
#define IMU_MPU9250_ACCEL_RANGE
#define IMU_MPU9250_GYRO_RANGE
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
const struct Int32Vect3 MPU9250_ACCEL_SENS_FRAC[4][2]
const struct Int32Rates MPU9250_GYRO_SENS_FRAC[4][2]
enum Mpu9250DLPFGyro dlpf_gyro_cfg
Digital Low Pass Filter for gyroscope.
enum Mpu9250GyroRanges gyro_range
deg/s Range
enum Mpu9250DLPFAccel dlpf_accel_cfg
Digital Low Pass Filter for accelerometer.
uint8_t smplrt_div
Sample rate divider.
enum Mpu9250AccelRanges accel_range
g Range
void mpu9250_i2c_event(struct Mpu9250_I2c *mpu)
void mpu9250_i2c_init(struct Mpu9250_I2c *mpu, struct i2c_periph *i2c_p, uint8_t addr)
struct Mpu9250Config config
union Mpu9250_I2c::@344 data_rates
struct Ak8963 akm
"internal" magnetometer
union Mpu9250_I2c::@343 data_accel
static void mpu9250_i2c_periodic(struct Mpu9250_I2c *mpu)
convenience function: read or start configuration if not already initialized
volatile bool data_available
data ready flag
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
Architecture independent timing functions.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.