Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the MPU-60X0 using SPI. More...
#include "peripherals/mpu60x0_spi.h"
Go to the source code of this file.
Macros | |
#define | Int16FromBuf(_buf, _idx) ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1])) |
Functions | |
void | mpu60x0_spi_init (struct Mpu60x0_Spi *mpu, struct spi_periph *spi_p, uint8_t slave_idx) |
static void | mpu60x0_spi_write_to_reg (void *mpu, uint8_t _reg, uint8_t _val) |
void | mpu60x0_spi_start_configure (struct Mpu60x0_Spi *mpu) |
void | mpu60x0_spi_read (struct Mpu60x0_Spi *mpu) |
void | mpu60x0_spi_event (struct Mpu60x0_Spi *mpu) |
bool | mpu60x0_configure_i2c_slaves (Mpu60x0ConfigSet mpu_set, void *mpu) |
configure the registered I2C slaves More... | |
Driver for the MPU-60X0 using SPI.
Definition in file mpu60x0_spi.c.
#define Int16FromBuf | ( | _buf, | |
_idx | |||
) | ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1])) |
Definition at line 127 of file mpu60x0_spi.c.
bool mpu60x0_configure_i2c_slaves | ( | Mpu60x0ConfigSet | mpu_set, |
void * | mpu | ||
) |
configure the registered I2C slaves
Configure I2C slaves of the MPU.
Definition at line 194 of file mpu60x0_spi.c.
References Mpu60x0_I2c::config, Mpu60x0_Spi::config, Mpu60x0I2cSlave::configure, Mpu60x0Config::i2c_bypass, Mpu60x0Config::i2c_mst_clk, Mpu60x0Config::i2c_mst_delay, MPU60X0_I2C_CONF_DONE, MPU60X0_I2C_CONF_I2C_BYPASS_DIS, MPU60X0_I2C_CONF_I2C_BYPASS_EN, MPU60X0_I2C_CONF_I2C_MST_CLK, MPU60X0_I2C_CONF_I2C_MST_DELAY, MPU60X0_I2C_CONF_I2C_MST_DIS, MPU60X0_I2C_CONF_I2C_MST_EN, MPU60X0_I2C_CONF_I2C_SMPLRT, MPU60X0_I2C_CONF_SLAVES_CONFIGURE, MPU60X0_I2C_CONF_UNINIT, MPU60X0_I2C_IF_DIS, MPU60X0_I2C_MST_EN, MPU60X0_I2C_NB_SLAVES, MPU60X0_REG_I2C_MST_CTRL, MPU60X0_REG_I2C_MST_DELAY, MPU60X0_REG_I2C_SLV4_CTRL, MPU60X0_REG_INT_PIN_CFG, MPU60X0_REG_USER_CTRL, MPU60X0_SPI_CONF_DONE, MPU60X0_SPI_CONF_I2C_MST_CLK, MPU60X0_SPI_CONF_I2C_MST_DELAY, MPU60X0_SPI_CONF_I2C_MST_EN, MPU60X0_SPI_CONF_SLAVES_CONFIGURE, MPU60X0_SPI_CONF_UNINIT, Mpu60x0Config::nb_slave_init, Mpu60x0Config::nb_slaves, Mpu60x0_I2c::slave_init_status, Mpu60x0_Spi::slave_init_status, and Mpu60x0Config::slaves.
Referenced by mpu60x0_send_config().
void mpu60x0_spi_event | ( | struct Mpu60x0_Spi * | mpu | ) |
Definition at line 129 of file mpu60x0_spi.c.
References Mpu60x0_Spi::config, Mpu60x0_Spi::data_accel, Mpu60x0_Spi::data_available, Mpu60x0_Spi::data_ext, Mpu60x0_Spi::data_rates, ICM20600, ICM20602, ICM20608, ICM20689, Mpu60x0Config::init_status, Mpu60x0Config::initialized, Int16FromBuf, MPU60X0_CONF_UNINIT, mpu60x0_send_config(), mpu60x0_spi_write_to_reg(), Mpu60x0Config::nb_bytes, Mpu60x0Config::nb_slaves, Mpu60x0_Spi::rx_buf, Mpu60x0_Spi::spi_trans, SPITransDone, SPITransFailed, SPITransSuccess, spi_transaction::status, Mpu60x0_Spi::temp, and Mpu60x0Config::type.
Referenced by imu_aspirin2_event(), imu_cube_event(), imu_mpu_hmc_event(), imu_mpu_spi_event(), and imu_px4fmu_event().
void mpu60x0_spi_init | ( | struct Mpu60x0_Spi * | mpu, |
struct spi_periph * | spi_p, | ||
uint8_t | slave_idx | ||
) |
Definition at line 31 of file mpu60x0_spi.c.
References spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, Mpu60x0_Spi::config, spi_transaction::cpha, spi_transaction::cpol, Mpu60x0_Spi::data_available, spi_transaction::dss, Mpu60x0Config::init_status, Mpu60x0Config::initialized, spi_transaction::input_buf, spi_transaction::input_length, MPU60X0_BUFFER_LEN, MPU60X0_CONF_UNINIT, mpu60x0_set_default_config(), MPU60X0_SPI_CONF_UNINIT, spi_transaction::output_buf, spi_transaction::output_length, Mpu60x0_Spi::rx_buf, spi_transaction::select, spi_transaction::slave_idx, Mpu60x0_Spi::slave_init_status, Mpu60x0_Spi::spi_p, Mpu60x0_Spi::spi_trans, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, and Mpu60x0_Spi::tx_buf.
Referenced by imu_aspirin2_init(), imu_cube_init(), imu_mpu_hmc_init(), imu_mpu_spi_init(), and imu_px4fmu_init().
void mpu60x0_spi_read | ( | struct Mpu60x0_Spi * | mpu | ) |
Definition at line 116 of file mpu60x0_spi.c.
References Mpu60x0_Spi::config, Mpu60x0Config::initialized, spi_transaction::input_length, MPU60X0_REG_INT_STATUS, MPU60X0_SPI_READ, Mpu60x0Config::nb_bytes, spi_transaction::output_length, Mpu60x0_Spi::spi_p, spi_submit(), Mpu60x0_Spi::spi_trans, SPITransDone, spi_transaction::status, and Mpu60x0_Spi::tx_buf.
Referenced by mpu60x0_spi_periodic().
void mpu60x0_spi_start_configure | ( | struct Mpu60x0_Spi * | mpu | ) |
Definition at line 77 of file mpu60x0_spi.c.
References Mpu60x0_Spi::config, ICM20600, ICM20600_WHOAMI_REPLY, ICM20602, ICM20602_WHOAMI_REPLY, ICM20608, ICM20608_WHOAMI_REPLY, ICM20689, ICM20689_WHOAMI_REPLY, Mpu60x0Config::init_status, spi_transaction::input_length, MPU60X0, MPU60X0_CONF_UNINIT, MPU60X0_REG_WHO_AM_I, mpu60x0_send_config(), MPU60X0_SPI_READ, mpu60x0_spi_write_to_reg(), MPU60X0_WHOAMI_REPLY, MPU6500_WHOAMI_REPLY, spi_transaction::output_length, Mpu60x0_Spi::rx_buf, Mpu60x0_Spi::spi_p, spi_submit(), Mpu60x0_Spi::spi_trans, SPITransDone, SPITransPending, SPITransRunning, SPITransSuccess, spi_transaction::status, Mpu60x0_Spi::tx_buf, and Mpu60x0Config::type.
Referenced by mpu60x0_spi_periodic().
Definition at line 66 of file mpu60x0_spi.c.
References spi_transaction::input_length, spi_transaction::output_length, Mpu60x0_Spi::spi_p, spi_submit(), Mpu60x0_Spi::spi_trans, and Mpu60x0_Spi::tx_buf.
Referenced by mpu60x0_spi_event(), and mpu60x0_spi_start_configure().