Paparazzi UAS
v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for ST LSM303DLHC 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 | lsm303dlhc_spi_init (struct Lsm303dlhc_Spi *lsm, struct spi_periph *spi_p, uint8_t slave_idx, enum Lsm303dlhcTarget target) |
static void | lsm303dlhc_spi_tx_reg (struct Lsm303dlhc_Spi *lsm, uint8_t reg, uint8_t val) |
static void | lsm303dlhc_spi_send_config (struct Lsm303dlhc_Spi *lsm) |
Configuration function called once before normal use. More... | |
void | lsm303dlhc_spi_start_configure (struct Lsm303dlhc_Spi *lsm) |
void | lsm303dlhc_spi_read (struct Lsm303dlhc_Spi *lsm) |
void | lsm303dlhc_spi_event (struct Lsm303dlhc_Spi *lsm) |
Driver for ST LSM303DLHC 3D accelerometer and magnetometer.
Definition in file lsm303dlhc_spi.c.
#define Int16FromBuf | ( | _buf, | |
_idx | |||
) | ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx])) |
Definition at line 179 of file lsm303dlhc_spi.c.
Referenced by lsm303dlhc_spi_event().
void lsm303dlhc_spi_event | ( | struct Lsm303dlhc_Spi * | lsm | ) |
Definition at line 181 of file lsm303dlhc_spi.c.
References Lsm303dlhc_Spi::data_accel, Lsm303dlhc_Spi::data_available_acc, Lsm303dlhc_Spi::data_available_mag, Lsm303dlhc_Spi::data_mag, Lsm303dlhc_Spi::init_status, Lsm303dlhc_Spi::initialized, Int16FromBuf, LSM303DLHC_REG_STATUS_ZYXADA, LSM303DLHC_REG_STATUS_ZYXMDA, lsm303dlhc_spi_send_config(), LSM_CONF_UNINIT, LSM_TARGET_ACC, Lsm303dlhc_Spi::rx_buf, Lsm303dlhc_Spi::spi_trans, SPITransDone, SPITransFailed, SPITransSuccess, spi_transaction::status, Lsm303dlhc_Spi::target, and TRUE.
Referenced by imu_px4_event().
void lsm303dlhc_spi_init | ( | struct Lsm303dlhc_Spi * | lsm, |
struct spi_periph * | spi_p, | ||
uint8_t | slave_idx, | ||
enum Lsm303dlhcTarget | target | ||
) |
Definition at line 32 of file lsm303dlhc_spi.c.
References spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, Lsm303dlhc_Spi::config, spi_transaction::cpha, spi_transaction::cpol, Lsm303dlhc_Spi::data_available_acc, Lsm303dlhc_Spi::data_available_mag, spi_transaction::dss, FALSE, Lsm303dlhc_Spi::init_status, Lsm303dlhc_Spi::initialized, spi_transaction::input_buf, spi_transaction::input_length, lsm303dlhc_acc_set_default_config(), lsm303dlhc_mag_set_default_config(), LSM_CONF_UNINIT, spi_transaction::output_buf, spi_transaction::output_length, Lsm303dlhc_Spi::rx_buf, spi_transaction::select, spi_transaction::slave_idx, Lsm303dlhc_Spi::spi_p, Lsm303dlhc_Spi::spi_trans, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, Lsm303dlhc_Spi::target, target, and Lsm303dlhc_Spi::tx_buf.
Referenced by imu_px4_init().
void lsm303dlhc_spi_read | ( | struct Lsm303dlhc_Spi * | lsm | ) |
Definition at line 158 of file lsm303dlhc_spi.c.
References Lsm303dlhc_Spi::initialized, spi_transaction::input_length, LSM303DLHC_REG_STATUS_REG_A, LSM303DLHC_REG_STATUS_REG_M, LSM_TARGET_ACC, spi_transaction::output_length, Lsm303dlhc_Spi::spi_p, spi_submit(), Lsm303dlhc_Spi::spi_trans, SPITransDone, spi_transaction::status, Lsm303dlhc_Spi::target, and Lsm303dlhc_Spi::tx_buf.
Referenced by lsm303dlhc_spi_periodic().
|
static |
Configuration function called once before normal use.
Definition at line 81 of file lsm303dlhc_spi.c.
References Lsm303dlhc_Spi::config, Lsm303dlhc_Spi::init_status, Lsm303dlhc_Spi::initialized, spi_transaction::input_length, LSM303DLHC_AHPM_MASK, LSM303DLHC_AODR_MASK, LSM303DLHC_FS_MASK, LSM303DLHC_I1_DRDY_A, LSM303DLHC_I2_DRDY_M, LSM303DLHC_M_ODR_MASK, LSM303DLHC_MFS_MASK, LSM303DLHC_REG_CTRL1, LSM303DLHC_REG_CTRL2, LSM303DLHC_REG_CTRL3, LSM303DLHC_REG_CTRL4, LSM303DLHC_REG_CTRL5, LSM303DLHC_REG_CTRL6, LSM303DLHC_REG_CTRL7, LSM303DLHC_REG_WHO_AM_I, lsm303dlhc_spi_tx_reg(), LSM303DLHC_WHO_I_AM, LSM303DLHC_Xen, LSM303DLHC_Yen, LSM303DLHC_Zen, LSM_CONF_CTRL_REG1, LSM_CONF_CTRL_REG2, LSM_CONF_CTRL_REG3, LSM_CONF_CTRL_REG4, LSM_CONF_CTRL_REG5, LSM_CONF_CTRL_REG6, LSM_CONF_CTRL_REG7, LSM_CONF_DONE, LSM_CONF_WHO_AM_I, LSM_TARGET_ACC, spi_transaction::output_length, Lsm303dlhc_Spi::rx_buf, Lsm303dlhc_Spi::spi_p, spi_submit(), Lsm303dlhc_Spi::spi_trans, SPITransDone, spi_transaction::status, Lsm303dlhc_Spi::target, TRUE, and Lsm303dlhc_Spi::tx_buf.
Referenced by lsm303dlhc_spi_event(), and lsm303dlhc_spi_start_configure().
void lsm303dlhc_spi_start_configure | ( | struct Lsm303dlhc_Spi * | lsm | ) |
Definition at line 147 of file lsm303dlhc_spi.c.
References Lsm303dlhc_Spi::init_status, lsm303dlhc_spi_send_config(), LSM_CONF_UNINIT, Lsm303dlhc_Spi::spi_trans, SPITransDone, SPITransSuccess, and spi_transaction::status.
Referenced by lsm303dlhc_spi_periodic().
|
static |
Definition at line 71 of file lsm303dlhc_spi.c.
References spi_transaction::input_length, spi_transaction::output_length, Lsm303dlhc_Spi::spi_p, spi_submit(), Lsm303dlhc_Spi::spi_trans, Lsm303dlhc_Spi::tx_buf, and val.
Referenced by lsm303dlhc_spi_send_config().