Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "peripherals/mpu9250_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 | mpu9250_spi_init (struct Mpu9250_Spi *mpu, struct spi_periph *spi_p, uint8_t slave_idx) |
static void | mpu9250_spi_write_to_reg (void *mpu, uint8_t _reg, uint8_t _val) |
void | mpu9250_spi_start_configure (struct Mpu9250_Spi *mpu) |
void | mpu9250_spi_read (struct Mpu9250_Spi *mpu) |
void | mpu9250_spi_event (struct Mpu9250_Spi *mpu) |
bool | mpu9250_configure_i2c_slaves (Mpu9250ConfigSet mpu_set, void *mpu) |
configure the registered I2C slaves More... | |
Driver for the MPU-9250 using SPI.
Definition in file mpu9250_spi.c.
#define Int16FromBuf | ( | _buf, | |
_idx | |||
) | ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1])) |
Definition at line 107 of file mpu9250_spi.c.
bool mpu9250_configure_i2c_slaves | ( | Mpu9250ConfigSet | mpu_set, |
void * | mpu | ||
) |
configure the registered I2C slaves
Configure I2C slaves of the MPU.
Definition at line 159 of file mpu9250_spi.c.
References Mpu9250_Spi::config, Mpu9250I2cSlave::configure, Mpu9250Config::i2c_mst_clk, Mpu9250Config::i2c_mst_delay, MPU9250_I2C_IF_DIS, MPU9250_I2C_MST_EN, MPU9250_I2C_NB_SLAVES, MPU9250_REG_I2C_MST_CTRL, MPU9250_REG_I2C_MST_DELAY, MPU9250_REG_USER_CTRL, MPU9250_SPI_CONF_DONE, MPU9250_SPI_CONF_I2C_MST_CLK, MPU9250_SPI_CONF_I2C_MST_DELAY, MPU9250_SPI_CONF_I2C_MST_EN, MPU9250_SPI_CONF_SLAVES_CONFIGURE, MPU9250_SPI_CONF_UNINIT, Mpu9250Config::nb_slave_init, Mpu9250Config::nb_slaves, Mpu9250_Spi::slave_init_status, and Mpu9250Config::slaves.
Referenced by mpu9250_send_config().
void mpu9250_spi_event | ( | struct Mpu9250_Spi * | mpu | ) |
Definition at line 109 of file mpu9250_spi.c.
References Mpu9250_Spi::config, Mpu9250_Spi::data_accel, Mpu9250_Spi::data_available, Mpu9250_Spi::data_ext, Mpu9250_Spi::data_rates, Mpu9250Config::init_status, Mpu9250Config::initialized, Int16FromBuf, MPU9250_CONF_UNINIT, mpu9250_send_config(), mpu9250_spi_write_to_reg(), Mpu9250Config::nb_bytes, Mpu9250Config::nb_slaves, Mpu9250_Spi::rx_buf, Mpu9250_Spi::spi_trans, SPITransDone, SPITransFailed, SPITransSuccess, and spi_transaction::status.
Referenced by imu_mpu9250_event().
void mpu9250_spi_init | ( | struct Mpu9250_Spi * | mpu, |
struct spi_periph * | spi_p, | ||
uint8_t | slave_idx | ||
) |
Definition at line 31 of file mpu9250_spi.c.
References spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, Mpu9250_Spi::config, spi_transaction::cpha, spi_transaction::cpol, Mpu9250_Spi::data_available, spi_transaction::dss, Mpu9250Config::init_status, Mpu9250Config::initialized, spi_transaction::input_buf, spi_transaction::input_length, MPU9250_BUFFER_LEN, MPU9250_CONF_UNINIT, mpu9250_set_default_config(), MPU9250_SPI_CONF_UNINIT, spi_transaction::output_buf, spi_transaction::output_length, Mpu9250_Spi::rx_buf, spi_transaction::select, spi_transaction::slave_idx, Mpu9250_Spi::slave_init_status, Mpu9250_Spi::spi_p, Mpu9250_Spi::spi_trans, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, and Mpu9250_Spi::tx_buf.
Referenced by imu_mpu9250_init().
void mpu9250_spi_read | ( | struct Mpu9250_Spi * | mpu | ) |
Definition at line 96 of file mpu9250_spi.c.
References Mpu9250_Spi::config, Mpu9250Config::initialized, spi_transaction::input_length, MPU9250_REG_INT_STATUS, MPU9250_SPI_READ, Mpu9250Config::nb_bytes, spi_transaction::output_length, Mpu9250_Spi::spi_p, spi_submit(), Mpu9250_Spi::spi_trans, SPITransDone, spi_transaction::status, and Mpu9250_Spi::tx_buf.
Referenced by mpu9250_spi_periodic().
void mpu9250_spi_start_configure | ( | struct Mpu9250_Spi * | mpu | ) |
Definition at line 77 of file mpu9250_spi.c.
References Mpu9250_Spi::config, Mpu9250Config::init_status, spi_transaction::input_length, MPU9250_CONF_UNINIT, MPU9250_REG_WHO_AM_I, mpu9250_send_config(), MPU9250_SPI_READ, mpu9250_spi_write_to_reg(), MPU9250_WHOAMI_REPLY, spi_transaction::output_length, Mpu9250_Spi::rx_buf, Mpu9250_Spi::spi_p, spi_submit(), Mpu9250_Spi::spi_trans, SPITransDone, SPITransPending, SPITransRunning, SPITransSuccess, spi_transaction::status, and Mpu9250_Spi::tx_buf.
Referenced by mpu9250_spi_periodic().
Definition at line 66 of file mpu9250_spi.c.
References spi_transaction::input_length, spi_transaction::output_length, Mpu9250_Spi::spi_p, spi_submit(), Mpu9250_Spi::spi_trans, and Mpu9250_Spi::tx_buf.
Referenced by mpu9250_spi_event(), and mpu9250_spi_start_configure().