|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
35 PRINT_CONFIG_VAR(IMU_MPU9250_SPI_SLAVE_IDX)
36 PRINT_CONFIG_VAR(IMU_MPU9250_SPI_DEV)
39 #if !defined IMU_MPU9250_GYRO_LOWPASS_FILTER && !defined IMU_MPU9250_ACCEL_LOWPASS_FILTER && !defined IMU_MPU9250_SMPLRT_DIV
40 #if (PERIODIC_FREQUENCY == 60) || (PERIODIC_FREQUENCY == 120)
45 #define IMU_MPU9250_GYRO_LOWPASS_FILTER MPU9250_DLPF_GYRO_41HZ
46 #define IMU_MPU9250_ACCEL_LOWPASS_FILTER MPU9250_DLPF_ACCEL_41HZ
47 #define IMU_MPU9250_SMPLRT_DIV 9
48 PRINT_CONFIG_MSG(
"Gyro/Accel output rate is 100Hz at 1kHz internal sampling")
49 #elif PERIODIC_FREQUENCY == 512
54 #define IMU_MPU9250_GYRO_LOWPASS_FILTER MPU9250_DLPF_GYRO_250HZ
55 #define IMU_MPU9250_ACCEL_LOWPASS_FILTER MPU9250_DLPF_ACCEL_184HZ
56 #define IMU_MPU9250_SMPLRT_DIV 3
60 #define IMU_MPU9250_SMPLRT_DIV 9
61 #define IMU_MPU9250_GYRO_LOWPASS_FILTER MPU9250_DLPF_GYRO_41HZ
62 #define IMU_MPU9250_ACCEL_LOWPASS_FILTER MPU9250_DLPF_ACCEL_41HZ
63 PRINT_CONFIG_MSG(
"Gyro/Accel output rate is 100Hz at 1kHz internal sampling")
74 #ifndef IMU_MPU9250_CHAN_X
75 #define IMU_MPU9250_CHAN_X 0
78 #ifndef IMU_MPU9250_CHAN_Y
79 #define IMU_MPU9250_CHAN_Y 1
82 #ifndef IMU_MPU9250_CHAN_Z
83 #define IMU_MPU9250_CHAN_Z 2
87 #ifndef IMU_MPU9250_X_SIGN
88 #define IMU_MPU9250_X_SIGN 1
91 #ifndef IMU_MPU9250_Y_SIGN
92 #define IMU_MPU9250_Y_SIGN 1
95 #ifndef IMU_MPU9250_Z_SIGN
96 #define IMU_MPU9250_Z_SIGN 1
100 #ifndef IMU_MPU9250_READ_MAG
101 #define IMU_MPU9250_READ_MAG TRUE
104 #ifndef IMU_MPU9250_MAG_STARTUP_DELAY
105 #define IMU_MPU9250_MAG_STARTUP_DELAY 1
127 #if IMU_MPU9250_READ_MAG
166 #define Int16FromBuf(_buf,_idx) ((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8)))
190 #if IMU_MPU9250_READ_MAG
216 mpu_set(mpu, _reg, _val);
struct Int32Rates gyro_unscaled
unscaled gyroscope measurements
void imu_mpu9250_event(void)
enum SPIClockDiv cdiv
prescaler of main clock to use as SPI clock
void mpu_wait_slave4_ready_cb(struct spi_transaction *t)
#define MPU9250_REG_I2C_SLV0_CTRL
static void mpu9250_spi_periodic(struct Mpu9250_Spi *mpu)
convenience function: read or start configuration if not already initialized
void imu_mpu9250_init(void)
enum Mpu9250MstClk i2c_mst_clk
MPU I2C master clock speed.
Mpu9250I2cSlaveConfigure configure
void mpu_wait_slave4_ready(void)
#define Int16FromBuf(_buf, _idx)
enum SPIClockPolarity cpol
clock polarity control
#define MPU9250_REG_I2C_MST_STATUS
#define MPU9250_REG_I2C_SLV4_DO
enum Mpu9250GyroRanges gyro_range
deg/s Range
void mpu9250_spi_event(struct Mpu9250_Spi *mpu)
bool imu_mpu9250_configure_mag_slave(Mpu9250ConfigSet mpu_set, void *mpu)
function to configure akm8963 mag
uint8_t nb_bytes
number of bytes to read starting with MPU9250_REG_INT_STATUS
struct Int32Vect3 accel
accelerometer measurements in m/s^2 in BFP with INT32_ACCEL_FRAC
uint16_t output_length
number of data words to write
#define IMU_MPU9250_Z_SIGN
static float get_sys_time_float(void)
Get the time in seconds since startup.
#define IMU_MPU9250_MAG_STARTUP_DELAY
SPI transaction structure.
union Mpu9250_I2c::@336 data_rates
enum Mpu9250DLPFAccel dlpf_accel_cfg
Digital Low Pass Filter for accelerometer.
enum Mpu9250DLPFGyro dlpf_gyro_cfg
Digital Low Pass Filter for gyroscope.
void mpu9250_spi_init(struct Mpu9250_Spi *mpu, struct spi_periph *spi_p, uint8_t slave_idx)
@ SPISelectUnselect
slave is selected before transaction and unselected after
enum SPIBitOrder bitorder
MSB/LSB order.
#define MPU9250_REG_I2C_SLV4_ADDR
struct Int32Vect3 accel_unscaled
unscaled accelerometer measurements
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
#define IMU_MPU9250_CHAN_X
volatile uint8_t wait_slave4_rx_buf[2]
enum SPISlaveSelect select
slave selection behavior
struct ImuMpu9250 imu_mpu9250
struct Mpu9250Config config
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
#define IMU_MPU9250_GYRO_LOWPASS_FILTER
#define IMU_MPU9250_CHAN_Z
void imu_mpu9250_periodic(void)
uint8_t data_ext[MPU9250_BUFFER_EXT_LEN]
enum SPIClockPhase cpha
clock phase control
SPICallback after_cb
NULL or function called after the transaction.
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit SPI transaction.
#define IMU_MPU9250_X_SIGN
Architecture independent timing functions.
@ SPICpolIdleHigh
CPOL = 1.
void imu_scale_gyro(struct Imu *_imu)
#define MPU9250_REG_I2C_SLV4_REG
enum Mpu9250AccelRanges accel_range
g Range
#define MPU9250_REG_I2C_SLV4_CTRL
#define IMU_MPU9250_Y_SIGN
#define AK8963_CNTL1_CM_2
static void mpu_set_and_wait(Mpu9250ConfigSet mpu_set, void *mpu, uint8_t _reg, uint8_t _val)
struct Imu imu
global IMU state
union Mpu9250_I2c::@335 data_accel
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
uint8_t nb_slaves
number of used I2C slaves
#define IMU_MPU9250_SMPLRT_DIV
#define MPU9250_I2C_SLV4_DONE
#define IMU_MPU9250_CHAN_Y
#define IMU_MPU9250_ACCEL_RANGE
uint16_t input_length
number of data words to read
uint8_t smplrt_div
Sample rate divider.
enum SPIDataSizeSelect dss
data transfer word size
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
void imu_scale_mag(struct Imu *_imu)
volatile bool slave4_ready
volatile uint8_t * input_buf
pointer to receive buffer for DMA
void(* Mpu9250ConfigSet)(void *mpu, uint8_t _reg, uint8_t _val)
Configuration function prototype.
#define MPU9250_REG_I2C_SLV0_REG
struct Int32Vect3 mag
magnetometer measurements scaled to 1 in BFP with INT32_MAG_FRAC
struct Int32Vect3 mag_unscaled
unscaled magnetometer measurements
volatile bool data_available
data ready flag
SPICallback before_cb
NULL or function called before the transaction.
struct Mpu9250I2cSlave slaves[MPU9250_I2C_NB_SLAVES]
I2C slaves.
#define RATES_COPY(_a, _b)
volatile uint8_t wait_slave4_tx_buf[1]
#define IMU_MPU9250_ACCEL_LOWPASS_FILTER
enum SPITransactionStatus status
void imu_scale_accel(struct Imu *_imu)
#define VECT3_COPY(_a, _b)
#define IMU_MPU9250_GYRO_RANGE
struct Int32Rates gyro
gyroscope measurements in rad/s in BFP with INT32_RATE_FRAC
struct spi_transaction wait_slave4_trans
#define MPU9250_REG_I2C_SLV0_ADDR
uint8_t i2c_mst_delay
MPU I2C slaves delayed sample rate.