Paparazzi UAS
v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for LIS302DL 3-axis accelerometer from ST using SPI. More...
#include "std.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/spi.h"
#include "peripherals/lis302dl.h"
Go to the source code of this file.
Data Structures | |
struct | Lis302dl_Spi |
union | Lis302dl_Spi.data |
Functions | |
void | lis302dl_spi_init (struct Lis302dl_Spi *lis, struct spi_periph *spi_p, uint8_t addr) |
void | lis302dl_spi_start_configure (struct Lis302dl_Spi *lis) |
void | lis302dl_spi_read (struct Lis302dl_Spi *lis) |
void | lis302dl_spi_event (struct Lis302dl_Spi *lis) |
static void | lis302dl_spi_periodic (struct Lis302dl_Spi *lis) |
convenience function: read or start configuration if not already initialized More... | |
Driver for LIS302DL 3-axis accelerometer from ST using SPI.
Definition in file lis302dl_spi.h.
struct Lis302dl_Spi |
Definition at line 39 of file lis302dl_spi.h.
Data Fields | ||
---|---|---|
struct Lis302dlConfig | config | |
union Lis302dl_Spi | data | |
volatile bool | data_available | data ready flag |
enum Lis302dlConfStatus | init_status | init status |
bool | initialized | config done flag |
volatile uint8_t | rx_buf[8] | |
struct spi_periph * | spi_p | |
struct spi_transaction | spi_trans | |
volatile uint8_t | tx_buf[2] |
union Lis302dl_Spi.data |
Definition at line 47 of file lis302dl_spi.h.
Data Fields | ||
---|---|---|
int8_t | value[3] | data values accessible by channel index |
struct Int8Vect3 | vect | data vector in accel coordinate system |
void lis302dl_spi_event | ( | struct Lis302dl_Spi * | lis | ) |
Definition at line 139 of file lis302dl_spi.c.
References Lis302dl_Spi::data, Lis302dl_Spi::data_available, Lis302dl_Spi::init_status, Lis302dl_Spi::initialized, lis302dl_spi_send_config(), LIS302DL_WHO_AM_I, LIS_CONF_UNINIT, LIS_CONF_WHO_AM_I, LIS_CONF_WHO_AM_I_OK, Lis302dl_Spi::rx_buf, Lis302dl_Spi::spi_trans, SPITransDone, SPITransFailed, SPITransSuccess, and spi_transaction::status.
void lis302dl_spi_init | ( | struct Lis302dl_Spi * | lis, |
struct spi_periph * | spi_p, | ||
uint8_t | addr | ||
) |
Definition at line 30 of file lis302dl_spi.c.
References spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, Lis302dl_Spi::config, spi_transaction::cpha, spi_transaction::cpol, Lis302dl_Spi::data_available, spi_transaction::dss, Lis302dl_Spi::init_status, Lis302dl_Spi::initialized, spi_transaction::input_buf, spi_transaction::input_length, lis302dl_set_default_config(), LIS_CONF_UNINIT, spi_transaction::output_buf, spi_transaction::output_length, Lis302dl_Spi::rx_buf, spi_transaction::select, spi_transaction::slave_idx, Lis302dl_Spi::spi_p, Lis302dl_Spi::spi_trans, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, and Lis302dl_Spi::tx_buf.
|
inlinestatic |
convenience function: read or start configuration if not already initialized
Definition at line 61 of file lis302dl_spi.h.
References Lis302dl_Spi::initialized, lis302dl_spi_read(), and lis302dl_spi_start_configure().
void lis302dl_spi_read | ( | struct Lis302dl_Spi * | lis | ) |
Definition at line 128 of file lis302dl_spi.c.
References Lis302dl_Spi::initialized, spi_transaction::input_length, LIS302DL_REG_STATUS, spi_transaction::output_length, Lis302dl_Spi::spi_p, spi_submit(), Lis302dl_Spi::spi_trans, SPITransDone, spi_transaction::status, and Lis302dl_Spi::tx_buf.
Referenced by lis302dl_spi_periodic().
void lis302dl_spi_start_configure | ( | struct Lis302dl_Spi * | lis | ) |
Definition at line 118 of file lis302dl_spi.c.
References Lis302dl_Spi::init_status, lis302dl_spi_send_config(), LIS_CONF_UNINIT, Lis302dl_Spi::spi_trans, SPITransDone, SPITransSuccess, and spi_transaction::status.
Referenced by lis302dl_spi_periodic().