Paparazzi UAS
v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
|
#include "std.h"
#include "mcu_periph/spi.h"
#include "math/pprz_algebra_int.h"
#include "peripherals/lsm303dlhc.h"
Go to the source code of this file.
Data Structures | |
struct | Lsm303dlhc_Spi |
union | Lsm303dlhc_Spi.data_accel |
union | Lsm303dlhc_Spi.data_mag |
union | Lsm303dlhc_Spi.config |
Functions | |
void | lsm303dlhc_spi_init (struct Lsm303dlhc_Spi *lsm, struct spi_periph *spi_p, uint8_t slave_idx, enum Lsm303dlhcTarget target) |
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) |
static void | lsm303dlhc_spi_periodic (struct Lsm303dlhc_Spi *lsm) |
convenience function: read or start configuration if not already initialized More... | |
struct Lsm303dlhc_Spi |
Definition at line 37 of file lsm303dlhc_spi.h.
Data Fields | ||
---|---|---|
union Lsm303dlhc_Spi | config | |
union Lsm303dlhc_Spi | data_accel | |
volatile bool | data_available_acc | data ready flag accelero |
volatile bool | data_available_mag | data ready flag magneto |
union Lsm303dlhc_Spi | data_mag | |
enum Lsm303dlhcConfStatus | init_status | |
bool | initialized | config done flag |
volatile uint8_t | rx_buf[8] | |
struct spi_periph * | spi_p | |
struct spi_transaction | spi_trans | |
enum Lsm303dlhcTarget | target | |
volatile uint8_t | tx_buf[2] |
union Lsm303dlhc_Spi.data_accel |
Definition at line 47 of file lsm303dlhc_spi.h.
Data Fields | ||
---|---|---|
int16_t | value[3] | data values accessible by channel index |
struct Int16Vect3 | vect | data vector in acc coordinate system |
union Lsm303dlhc_Spi.data_mag |
Definition at line 51 of file lsm303dlhc_spi.h.
Data Fields | ||
---|---|---|
int16_t | value[3] | data values accessible by channel index |
struct Int16Vect3 | vect | data vector in mag coordinate system |
union Lsm303dlhc_Spi.config |
Definition at line 55 of file lsm303dlhc_spi.h.
Data Fields | ||
---|---|---|
struct Lsm303dlhcAccConfig | acc | |
struct Lsm303dlhcMagConfig | mag |
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().
|
inlinestatic |
convenience function: read or start configuration if not already initialized
Definition at line 71 of file lsm303dlhc_spi.h.
References Lsm303dlhc_Spi::initialized, lsm303dlhc_spi_read(), and lsm303dlhc_spi_start_configure().
Referenced by imu_px4_periodic().
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().
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().