Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "subsystems/imu.h"
#include "subsystems/abi.h"
#include "mcu_periph/sys_time.h"
#include "mcu_periph/spi.h"
#include "peripherals/ak8963_regs.h"
Go to the source code of this file.
Macros | |
#define | IMU_MPU9250_SMPLRT_DIV 9 |
#define | IMU_MPU9250_GYRO_LOWPASS_FILTER MPU9250_DLPF_GYRO_41HZ |
#define | IMU_MPU9250_ACCEL_LOWPASS_FILTER MPU9250_DLPF_ACCEL_41HZ |
#define | IMU_MPU9250_CHAN_X 0 |
#define | IMU_MPU9250_CHAN_Y 1 |
#define | IMU_MPU9250_CHAN_Z 2 |
#define | IMU_MPU9250_X_SIGN 1 |
#define | IMU_MPU9250_Y_SIGN 1 |
#define | IMU_MPU9250_Z_SIGN 1 |
#define | IMU_MPU9250_READ_MAG TRUE |
#define | IMU_MPU9250_MAG_STARTUP_DELAY 1 |
#define | Int16FromBuf(_buf, _idx) ((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8))) |
Functions | |
void | mpu_wait_slave4_ready (void) |
void | mpu_wait_slave4_ready_cb (struct spi_transaction *t) |
bool | imu_mpu9250_configure_mag_slave (Mpu9250ConfigSet mpu_set, void *mpu) |
function to configure akm8963 mag More... | |
void | imu_mpu9250_init (void) |
void | imu_mpu9250_periodic (void) |
void | imu_mpu9250_event (void) |
static void | mpu_set_and_wait (Mpu9250ConfigSet mpu_set, void *mpu, uint8_t _reg, uint8_t _val) |
Variables | |
struct ImuMpu9250 | imu_mpu9250 |
IMU driver for the MPU9250 using SPI
Definition in file imu_mpu9250_spi.c.
#define IMU_MPU9250_ACCEL_LOWPASS_FILTER MPU9250_DLPF_ACCEL_41HZ |
Definition at line 62 of file imu_mpu9250_spi.c.
#define IMU_MPU9250_CHAN_X 0 |
Definition at line 75 of file imu_mpu9250_spi.c.
#define IMU_MPU9250_CHAN_Y 1 |
Definition at line 79 of file imu_mpu9250_spi.c.
#define IMU_MPU9250_CHAN_Z 2 |
Definition at line 83 of file imu_mpu9250_spi.c.
#define IMU_MPU9250_GYRO_LOWPASS_FILTER MPU9250_DLPF_GYRO_41HZ |
Definition at line 61 of file imu_mpu9250_spi.c.
#define IMU_MPU9250_MAG_STARTUP_DELAY 1 |
Definition at line 105 of file imu_mpu9250_spi.c.
#define IMU_MPU9250_READ_MAG TRUE |
Definition at line 101 of file imu_mpu9250_spi.c.
#define IMU_MPU9250_SMPLRT_DIV 9 |
Definition at line 60 of file imu_mpu9250_spi.c.
#define IMU_MPU9250_X_SIGN 1 |
Definition at line 88 of file imu_mpu9250_spi.c.
#define IMU_MPU9250_Y_SIGN 1 |
Definition at line 92 of file imu_mpu9250_spi.c.
#define IMU_MPU9250_Z_SIGN 1 |
Definition at line 96 of file imu_mpu9250_spi.c.
#define Int16FromBuf | ( | _buf, | |
_idx | |||
) | ((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8))) |
Definition at line 166 of file imu_mpu9250_spi.c.
bool imu_mpu9250_configure_mag_slave | ( | Mpu9250ConfigSet | mpu_set, |
void * | mpu | ||
) |
function to configure akm8963 mag
Definition at line 223 of file imu_mpu9250_spi.c.
References AK8963_CNTL1_CM_2, AK8963_REG_CNTL1, AK8963_REG_CNTL2, AK8963_REG_HXL, get_sys_time_float(), IMU_MPU9250_MAG_STARTUP_DELAY, MPU9250_MAG_ADDR, MPU9250_REG_I2C_SLV0_ADDR, MPU9250_REG_I2C_SLV0_CTRL, MPU9250_REG_I2C_SLV0_REG, MPU9250_REG_I2C_SLV4_ADDR, MPU9250_REG_I2C_SLV4_CTRL, MPU9250_REG_I2C_SLV4_DO, MPU9250_REG_I2C_SLV4_REG, MPU9250_SPI_READ, mpu_set_and_wait(), and mpu_wait_slave4_ready().
Referenced by imu_mpu9250_init().
void imu_mpu9250_event | ( | void | ) |
Definition at line 167 of file imu_mpu9250_spi.c.
References Imu::accel, Imu::accel_unscaled, Mpu9250_I2c::data_accel, Mpu9250_I2c::data_available, Mpu9250_I2c::data_ext, Mpu9250_I2c::data_rates, get_sys_time_usec(), Imu::gyro, Imu::gyro_unscaled, imu, imu_mpu9250, IMU_MPU9250_CHAN_X, IMU_MPU9250_CHAN_Y, IMU_MPU9250_CHAN_Z, IMU_MPU9250_ID, IMU_MPU9250_X_SIGN, IMU_MPU9250_Y_SIGN, IMU_MPU9250_Z_SIGN, imu_scale_accel(), imu_scale_gyro(), imu_scale_mag(), Int16FromBuf, Imu::mag, Imu::mag_unscaled, ImuMpu9250::mpu, mpu9250, mpu9250_i2c_event(), mpu9250_spi_event(), RATES_COPY, VECT3_COPY, Int32Vect3::x, Int32Vect3::y, and Int32Vect3::z.
void imu_mpu9250_init | ( | void | ) |
Definition at line 114 of file imu_mpu9250_spi.c.
References Mpu9250Config::accel_range, spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, Mpu9250_I2c::config, Mpu9250I2cSlave::configure, spi_transaction::cpha, spi_transaction::cpol, Mpu9250Config::dlpf_accel_cfg, Mpu9250Config::dlpf_gyro_cfg, spi_transaction::dss, Mpu9250Config::gyro_range, Mpu9250Config::i2c_mst_clk, Mpu9250Config::i2c_mst_delay, imu_mpu9250, IMU_MPU9250_ACCEL_LOWPASS_FILTER, IMU_MPU9250_ACCEL_RANGE, IMU_MPU9250_ADDR, imu_mpu9250_configure_mag_slave(), IMU_MPU9250_GYRO_LOWPASS_FILTER, IMU_MPU9250_GYRO_RANGE, IMU_MPU9250_SMPLRT_DIV, spi_transaction::input_buf, spi_transaction::input_length, ImuMpu9250::mpu, mpu9250, mpu9250_i2c_init(), MPU9250_MST_CLK_400KHZ, mpu9250_spi_init(), mpu_wait_slave4_ready_cb(), Mpu9250Config::nb_bytes, Mpu9250Config::nb_slaves, spi_transaction::output_buf, spi_transaction::output_length, spi_transaction::select, ImuMpu9250::slave4_ready, spi_transaction::slave_idx, Mpu9250Config::slaves, Mpu9250Config::smplrt_div, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, ImuMpu9250::wait_slave4_rx_buf, ImuMpu9250::wait_slave4_trans, and ImuMpu9250::wait_slave4_tx_buf.
void imu_mpu9250_periodic | ( | void | ) |
Definition at line 161 of file imu_mpu9250_spi.c.
References imu_mpu9250, ImuMpu9250::mpu, mpu9250, mpu9250_i2c_periodic(), and mpu9250_spi_periodic().
|
inlinestatic |
Definition at line 214 of file imu_mpu9250_spi.c.
References imu_mpu9250, ImuMpu9250::mpu, and SPITransSuccess.
Referenced by imu_mpu9250_configure_mag_slave().
void mpu_wait_slave4_ready | ( | void | ) |
Definition at line 258 of file imu_mpu9250_spi.c.
References imu_mpu9250, ImuMpu9250::mpu, MPU9250_REG_I2C_MST_STATUS, MPU9250_SPI_READ, ImuMpu9250::slave4_ready, spi_submit(), SPITransDone, spi_transaction::status, ImuMpu9250::wait_slave4_trans, and ImuMpu9250::wait_slave4_tx_buf.
Referenced by imu_mpu9250_configure_mag_slave().
void mpu_wait_slave4_ready_cb | ( | struct spi_transaction * | t | ) |
Definition at line 268 of file imu_mpu9250_spi.c.
References imu_mpu9250, spi_transaction::input_buf, MPU9250_I2C_SLV4_DONE, ImuMpu9250::slave4_ready, SPITransDone, and spi_transaction::status.
Referenced by imu_mpu9250_init().
struct ImuMpu9250 imu_mpu9250 |
Definition at line 108 of file imu_mpu9250_spi.c.
Referenced by imu_mpu9250_event(), imu_mpu9250_init(), imu_mpu9250_periodic(), mpu_set_and_wait(), mpu_wait_slave4_ready(), and mpu_wait_slave4_ready_cb().