Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "std.h"
#include "mcu_periph/spi.h"
#include "math/pprz_algebra_int.h"
#include "peripherals/lsm303d.h"
Go to the source code of this file.
Data Structures | |
struct | Lsm303d_Spi |
union | Lsm303d_Spi.data_accel |
union | Lsm303d_Spi.data_mag |
Functions | |
void | lsm303d_spi_init (struct Lsm303d_Spi *lsm, struct spi_periph *spi_p, uint8_t slave_idx, enum Lsm303dTarget target) |
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) |
static void | lsm303d_spi_periodic (struct Lsm303d_Spi *lsm) |
convenience function: read or start configuration if not already initialized More... | |
Driver for ST LSM303D 3D accelerometer and magnetometer.
Definition in file lsm303d_spi.h.
struct Lsm303d_Spi |
Definition at line 37 of file lsm303d_spi.h.
Data Fields | ||
---|---|---|
struct Lsm303dConfig | conf | |
union Lsm303d_Spi | data_accel | |
volatile bool | data_available_acc | data ready flag accelero |
volatile bool | data_available_mag | data ready flag magneto |
union Lsm303d_Spi | data_mag | |
enum Lsm303dConfStatus | init_status | |
bool | initialized | config done flag |
volatile uint8_t | rx_buf[8] | |
struct spi_periph * | spi_p | |
struct spi_transaction | spi_trans | |
enum Lsm303dTarget | target | |
volatile uint8_t | tx_buf[2] |
union Lsm303d_Spi.data_accel |
Definition at line 47 of file lsm303d_spi.h.
Data Fields | ||
---|---|---|
int16_t | value[3] | data values accessible by channel index |
struct Int16Vect3 | vect | data vector in acc coordinate system |
union Lsm303d_Spi.data_mag |
Definition at line 51 of file lsm303d_spi.h.
Data Fields | ||
---|---|---|
int16_t | value[3] | data values accessible by channel index |
struct Int16Vect3 | vect | data vector in mag coordinate system |
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().
|
inlinestatic |
convenience function: read or start configuration if not already initialized
Definition at line 68 of file lsm303d_spi.h.
References Lsm303d_Spi::initialized, lsm303d_spi_read(), and lsm303d_spi_start_configure().
Referenced by imu_px4_periodic().
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().
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().