Paparazzi UAS
v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the Aspirin v2.x IMU using SPI for the MPU6000. More...
#include "subsystems/imu.h"
#include "subsystems/abi.h"
#include "mcu_periph/sys_time.h"
#include "mcu_periph/spi.h"
#include "peripherals/hmc58xx_regs.h"
Go to the source code of this file.
Macros | |
#define | ASPIRIN_2_SPI_SLAVE_IDX SPI_SLAVE2 |
#define | ASPIRIN_2_SPI_DEV spi2 |
#define | HMC58XX_DO 0x6 |
#define | HMC58XX_MS 0x0 |
#define | HMC58XX_GN 0x1 |
#define | HMC58XX_MD 0x0 |
#define | HMC58XX_CRA ((HMC58XX_DO<<2)|(HMC58XX_MS)) |
#define | HMC58XX_CRB (HMC58XX_GN<<5) |
#define | ASPIRIN_2_MAG_STARTUP_DELAY 1.5 |
delay in seconds before starting to configure HMC58xx mag slave More... | |
#define | Int16FromBuf(_buf, _idx) ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1])) |
Functions | |
void | mpu_wait_slave4_ready (void) |
void | mpu_wait_slave4_ready_cb (struct spi_transaction *t) |
bool | imu_aspirin2_configure_mag_slave (Mpu60x0ConfigSet mpu_set, void *mpu) |
function to configure hmc5883 mag More... | |
void | imu_aspirin2_init (void) |
void | imu_aspirin2_periodic (void) |
void | imu_aspirin2_event (void) |
static void | mpu_set_and_wait (Mpu60x0ConfigSet mpu_set, void *mpu, uint8_t _reg, uint8_t _val) |
Variables | |
struct ImuAspirin2Spi | imu_aspirin2 |
Driver for the Aspirin v2.x IMU using SPI for the MPU6000.
Definition in file imu_aspirin_2_spi.c.
#define ASPIRIN_2_MAG_STARTUP_DELAY 1.5 |
delay in seconds before starting to configure HMC58xx mag slave
Definition at line 90 of file imu_aspirin_2_spi.c.
Referenced by imu_aspirin2_configure_mag_slave().
#define ASPIRIN_2_SPI_DEV spi2 |
Definition at line 40 of file imu_aspirin_2_spi.c.
Referenced by imu_aspirin2_init().
#define ASPIRIN_2_SPI_SLAVE_IDX SPI_SLAVE2 |
Definition at line 35 of file imu_aspirin_2_spi.c.
Referenced by imu_aspirin2_init().
#define HMC58XX_CRA ((HMC58XX_DO<<2)|(HMC58XX_MS)) |
Definition at line 85 of file imu_aspirin_2_spi.c.
Referenced by imu_aspirin2_configure_mag_slave().
#define HMC58XX_CRB (HMC58XX_GN<<5) |
Definition at line 86 of file imu_aspirin_2_spi.c.
Referenced by imu_aspirin2_configure_mag_slave().
#define HMC58XX_DO 0x6 |
Definition at line 73 of file imu_aspirin_2_spi.c.
#define HMC58XX_GN 0x1 |
Definition at line 79 of file imu_aspirin_2_spi.c.
#define HMC58XX_MD 0x0 |
Definition at line 82 of file imu_aspirin_2_spi.c.
Referenced by imu_aspirin2_configure_mag_slave().
#define HMC58XX_MS 0x0 |
Definition at line 76 of file imu_aspirin_2_spi.c.
#define Int16FromBuf | ( | _buf, | |
_idx | |||
) | ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1])) |
Definition at line 152 of file imu_aspirin_2_spi.c.
Referenced by imu_aspirin2_event().
bool imu_aspirin2_configure_mag_slave | ( | Mpu60x0ConfigSet | mpu_set, |
void * | mpu | ||
) |
function to configure hmc5883 mag
Definition at line 254 of file imu_aspirin_2_spi.c.
References ASPIRIN_2_MAG_STARTUP_DELAY, get_sys_time_float(), HMC58XX_ADDR, HMC58XX_CRA, HMC58XX_CRB, HMC58XX_MD, HMC58XX_REG_CFGA, HMC58XX_REG_CFGB, HMC58XX_REG_DATXM, HMC58XX_REG_MODE, MPU60X0_REG_I2C_SLV0_ADDR, MPU60X0_REG_I2C_SLV0_CTRL, MPU60X0_REG_I2C_SLV0_REG, MPU60X0_REG_I2C_SLV4_ADDR, MPU60X0_REG_I2C_SLV4_CTRL, MPU60X0_REG_I2C_SLV4_DO, MPU60X0_REG_I2C_SLV4_REG, MPU60X0_SPI_READ, mpu_set_and_wait(), and mpu_wait_slave4_ready().
Referenced by imu_aspirin2_init().
void imu_aspirin2_event | ( | void | ) |
Definition at line 154 of file imu_aspirin_2_spi.c.
References Imu::accel, Imu::accel_unscaled, Mpu60x0_Spi::data_accel, Mpu60x0_Spi::data_available, Mpu60x0_Spi::data_ext, Mpu60x0_Spi::data_rates, get_sys_time_usec(), Imu::gyro, Imu::gyro_unscaled, imu, imu_aspirin2, IMU_ASPIRIN2_ID, imu_scale_accel(), imu_scale_gyro(), imu_scale_mag(), Int16FromBuf, Imu::mag, Imu::mag_unscaled, ImuAspirin2Spi::mpu, mpu60x0_spi_event(), RATES_ASSIGN, RATES_COPY, VECT3_ASSIGN, VECT3_COPY, Int32Vect3::x, Int32Vect3::y, and Int32Vect3::z.
void imu_aspirin2_init | ( | void | ) |
Definition at line 99 of file imu_aspirin_2_spi.c.
References Mpu60x0Config::accel_range, spi_transaction::after_cb, ASPIRIN_2_ACCEL_RANGE, ASPIRIN_2_GYRO_RANGE, ASPIRIN_2_SPI_DEV, ASPIRIN_2_SPI_SLAVE_IDX, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, Mpu60x0_Spi::config, Mpu60x0I2cSlave::configure, spi_transaction::cpha, spi_transaction::cpol, Mpu60x0Config::dlpf_cfg, spi_transaction::dss, Mpu60x0Config::gyro_range, Mpu60x0Config::i2c_mst_clk, Mpu60x0Config::i2c_mst_delay, imu_aspirin2, imu_aspirin2_configure_mag_slave(), spi_transaction::input_buf, spi_transaction::input_length, ImuAspirin2Spi::mpu, MPU60X0_MST_CLK_400KHZ, mpu60x0_spi_init(), mpu_wait_slave4_ready_cb(), Mpu60x0Config::nb_bytes, Mpu60x0Config::nb_slaves, spi_transaction::output_buf, spi_transaction::output_length, spi_transaction::select, ImuAspirin2Spi::slave4_ready, spi_transaction::slave_idx, Mpu60x0Config::slaves, Mpu60x0Config::smplrt_div, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, ImuAspirin2Spi::wait_slave4_rx_buf, ImuAspirin2Spi::wait_slave4_trans, and ImuAspirin2Spi::wait_slave4_tx_buf.
void imu_aspirin2_periodic | ( | void | ) |
Definition at line 147 of file imu_aspirin_2_spi.c.
References imu_aspirin2, ImuAspirin2Spi::mpu, and mpu60x0_spi_periodic().
|
inlinestatic |
Definition at line 245 of file imu_aspirin_2_spi.c.
References imu_aspirin2, ImuAspirin2Spi::mpu, Mpu60x0_Spi::spi_trans, SPITransSuccess, and spi_transaction::status.
Referenced by imu_aspirin2_configure_mag_slave().
void mpu_wait_slave4_ready | ( | void | ) |
Definition at line 291 of file imu_aspirin_2_spi.c.
References imu_aspirin2, ImuAspirin2Spi::mpu, MPU60X0_REG_I2C_MST_STATUS, MPU60X0_SPI_READ, ImuAspirin2Spi::slave4_ready, Mpu60x0_Spi::spi_p, spi_submit(), SPITransDone, spi_transaction::status, ImuAspirin2Spi::wait_slave4_trans, and ImuAspirin2Spi::wait_slave4_tx_buf.
Referenced by imu_aspirin2_configure_mag_slave().
void mpu_wait_slave4_ready_cb | ( | struct spi_transaction * | t | ) |
Definition at line 301 of file imu_aspirin_2_spi.c.
References imu_aspirin2, spi_transaction::input_buf, MPU60X0_I2C_SLV4_DONE, ImuAspirin2Spi::slave4_ready, SPITransDone, and spi_transaction::status.
Referenced by imu_aspirin2_init().
struct ImuAspirin2Spi imu_aspirin2 |
Definition at line 93 of file imu_aspirin_2_spi.c.
Referenced by imu_aspirin2_event(), imu_aspirin2_init(), imu_aspirin2_periodic(), mpu_set_and_wait(), mpu_wait_slave4_ready(), and mpu_wait_slave4_ready_cb().