Paparazzi UAS
v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for ST LSM303D 3D accelerometer and magnetometer. More...
Go to the source code of this file.
Macros | |
#define | Int16FromBuf(_buf, _idx) ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx])) |
Functions | |
void | lsm303d_spi_init (struct Lsm303d_Spi *lsm, struct spi_periph *spi_p, uint8_t slave_idx, enum Lsm303dTarget target) |
static void | lsm303d_spi_tx_reg (struct Lsm303d_Spi *lsm, uint8_t reg, uint8_t val) |
static void | lsm303d_spi_send_config (struct Lsm303d_Spi *lsm) |
Configuration function called once before normal use. More... | |
void | lsm303d_spi_start_configure (struct Lsm303d_Spi *lsm) |
void | lsm303d_spi_read (struct Lsm303d_Spi *lsm) |
void | lsm303d_spi_event (struct Lsm303d_Spi *lsm) |
Driver for ST LSM303D 3D accelerometer and magnetometer.
Definition in file lsm303d_spi.c.
#define Int16FromBuf | ( | _buf, | |
_idx | |||
) | ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx])) |
Definition at line 172 of file lsm303d_spi.c.
Referenced by lsm303d_spi_event().
void lsm303d_spi_event | ( | struct Lsm303d_Spi * | lsm | ) |
Definition at line 176 of file lsm303d_spi.c.
References Lsm303d_Spi::data_accel, Lsm303d_Spi::data_available_acc, Lsm303d_Spi::data_available_mag, Lsm303d_Spi::data_mag, Lsm303d_Spi::init_status, Lsm303d_Spi::initialized, Int16FromBuf, LSM303D_CONF_UNINIT, lsm303d_spi_send_config(), LSM303D_TARGET_ACC, LSM303D_ZYXADA, LSM303D_ZYXMDA, Lsm303d_Spi::rx_buf, Lsm303d_Spi::spi_trans, SPITransDone, SPITransFailed, SPITransSuccess, spi_transaction::status, Lsm303d_Spi::target, and TRUE.
Referenced by imu_px4_event().
void lsm303d_spi_init | ( | struct Lsm303d_Spi * | lsm, |
struct spi_periph * | spi_p, | ||
uint8_t | slave_idx, | ||
enum Lsm303dTarget | target | ||
) |
Definition at line 32 of file lsm303d_spi.c.
References spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, Lsm303d_Spi::conf, spi_transaction::cpha, spi_transaction::cpol, Lsm303d_Spi::data_available_acc, Lsm303d_Spi::data_available_mag, spi_transaction::dss, FALSE, Lsm303d_Spi::init_status, Lsm303d_Spi::initialized, spi_transaction::input_buf, spi_transaction::input_length, LSM303D_CONF_UNINIT, lsm303d_set_default_config(), spi_transaction::output_buf, spi_transaction::output_length, Lsm303d_Spi::rx_buf, spi_transaction::select, spi_transaction::slave_idx, Lsm303d_Spi::spi_p, Lsm303d_Spi::spi_trans, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, Lsm303d_Spi::target, target, and Lsm303d_Spi::tx_buf.
Referenced by imu_px4_init().
void lsm303d_spi_read | ( | struct Lsm303d_Spi * | lsm | ) |
Definition at line 151 of file lsm303d_spi.c.
References Lsm303d_Spi::initialized, spi_transaction::input_length, LSM303D_REG_STATUS_A, LSM303D_REG_STATUS_M, LSM303D_TARGET_ACC, spi_transaction::output_length, Lsm303d_Spi::spi_p, spi_submit(), Lsm303d_Spi::spi_trans, SPITransDone, spi_transaction::status, Lsm303d_Spi::target, and Lsm303d_Spi::tx_buf.
Referenced by lsm303d_spi_periodic().
|
static |
Configuration function called once before normal use.
Definition at line 80 of file lsm303d_spi.c.
References Lsm303dConfig::acc_rate, Lsm303dConfig::acc_scale, Lsm303d_Spi::conf, Lsm303d_Spi::init_status, Lsm303d_Spi::initialized, spi_transaction::input_length, LSM303D_AFS_MASK, LSM303D_AHPM_MASK, LSM303D_AODR_MASK, LSM303D_AXEN, LSM303D_AYEN, LSM303D_AZEN, LSM303D_CONF_CTRL_REG1, LSM303D_CONF_CTRL_REG2, LSM303D_CONF_CTRL_REG3, LSM303D_CONF_CTRL_REG4, LSM303D_CONF_CTRL_REG5, LSM303D_CONF_CTRL_REG6, LSM303D_CONF_CTRL_REG7, LSM303D_CONF_DONE, LSM303D_CONF_WHO_AM_I, LSM303D_INT1_DRDY_A, LSM303D_INT2_DRDY_M, LSM303D_M_ODR_MASK, LSM303D_MFS_MASK, LSM303D_REG_CTRL1, LSM303D_REG_CTRL2, LSM303D_REG_CTRL3, LSM303D_REG_CTRL4, LSM303D_REG_CTRL5, LSM303D_REG_CTRL6, LSM303D_REG_CTRL7, LSM303D_REG_WHO_AM_I, LSM303D_REG_WHO_I_AM, lsm303d_spi_tx_reg(), Lsm303dConfig::mag_mode, Lsm303dConfig::mag_rate, Lsm303dConfig::mag_scale, spi_transaction::output_length, Lsm303d_Spi::rx_buf, Lsm303d_Spi::spi_p, spi_submit(), Lsm303d_Spi::spi_trans, SPITransDone, spi_transaction::status, TRUE, and Lsm303d_Spi::tx_buf.
Referenced by lsm303d_spi_event(), and lsm303d_spi_start_configure().
void lsm303d_spi_start_configure | ( | struct Lsm303d_Spi * | lsm | ) |
Definition at line 140 of file lsm303d_spi.c.
References Lsm303d_Spi::init_status, LSM303D_CONF_UNINIT, lsm303d_spi_send_config(), Lsm303d_Spi::spi_trans, SPITransDone, SPITransSuccess, and spi_transaction::status.
Referenced by lsm303d_spi_periodic().
|
static |
Definition at line 70 of file lsm303d_spi.c.
References spi_transaction::input_length, spi_transaction::output_length, Lsm303d_Spi::spi_p, spi_submit(), Lsm303d_Spi::spi_trans, Lsm303d_Spi::tx_buf, and val.
Referenced by lsm303d_spi_send_config().