Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the accelerometer ADXL345 from Analog Devices using SPI. More...
#include "std.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/spi.h"
#include "peripherals/adxl345.h"
Go to the source code of this file.
Data Structures | |
struct | Adxl345_Spi |
union | Adxl345_Spi.data |
Functions | |
void | adxl345_spi_init (struct Adxl345_Spi *adxl, struct spi_periph *spi_p, uint8_t addr) |
void | adxl345_spi_start_configure (struct Adxl345_Spi *adxl) |
void | adxl345_spi_read (struct Adxl345_Spi *adxl) |
void | adxl345_spi_event (struct Adxl345_Spi *adxl) |
static void | adxl345_spi_periodic (struct Adxl345_Spi *adxl) |
convenience function: read or start configuration if not already initialized More... | |
Driver for the accelerometer ADXL345 from Analog Devices using SPI.
Definition in file adxl345_spi.h.
struct Adxl345_Spi |
Definition at line 39 of file adxl345_spi.h.
Data Fields | ||
---|---|---|
struct Adxl345Config | config | |
union Adxl345_Spi | data | |
volatile bool | data_available | data ready flag |
enum Adxl345ConfStatus | init_status | init status |
bool | initialized | config done flag |
volatile uint8_t | rx_buf[7] | |
struct spi_periph * | spi_p | |
struct spi_transaction | spi_trans | |
volatile uint8_t | tx_buf[7] |
union Adxl345_Spi.data |
Definition at line 47 of file adxl345_spi.h.
Data Fields | ||
---|---|---|
int16_t | value[3] | data values accessible by channel index |
struct Int16Vect3 | vect | data vector in accel coordinate system |
void adxl345_spi_event | ( | struct Adxl345_Spi * | adxl | ) |
Definition at line 131 of file adxl345_spi.c.
References adxl345_spi_send_config(), ADXL_CONF_UNINIT, Adxl345_Spi::data, Adxl345_Spi::data_available, Adxl345_Spi::init_status, Adxl345_Spi::initialized, Int16FromBuf, Adxl345_Spi::rx_buf, Adxl345_Spi::spi_trans, SPITransDone, SPITransFailed, SPITransSuccess, and spi_transaction::status.
Referenced by imu_aspirin_event().
void adxl345_spi_init | ( | struct Adxl345_Spi * | adxl, |
struct spi_periph * | spi_p, | ||
uint8_t | addr | ||
) |
Definition at line 35 of file adxl345_spi.c.
References adxl345_set_default_config(), ADXL_CONF_UNINIT, spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, Adxl345_Spi::config, spi_transaction::cpha, spi_transaction::cpol, Adxl345_Spi::data_available, spi_transaction::dss, Adxl345_Spi::init_status, Adxl345_Spi::initialized, spi_transaction::input_buf, spi_transaction::input_length, spi_transaction::output_buf, spi_transaction::output_length, Adxl345_Spi::rx_buf, spi_transaction::select, spi_transaction::slave_idx, Adxl345_Spi::spi_p, Adxl345_Spi::spi_trans, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, and Adxl345_Spi::tx_buf.
Referenced by imu_aspirin_init().
|
inlinestatic |
convenience function: read or start configuration if not already initialized
Definition at line 61 of file adxl345_spi.h.
References adxl345_spi_read(), adxl345_spi_start_configure(), and Adxl345_Spi::initialized.
Referenced by imu_aspirin_periodic().
void adxl345_spi_read | ( | struct Adxl345_Spi * | adxl | ) |
Definition at line 118 of file adxl345_spi.c.
References ADXL345_REG_DATA_X0, Adxl345_Spi::initialized, spi_transaction::input_length, spi_transaction::output_length, Adxl345_Spi::spi_p, spi_submit(), Adxl345_Spi::spi_trans, SPITransDone, spi_transaction::status, and Adxl345_Spi::tx_buf.
Referenced by adxl345_spi_periodic().
void adxl345_spi_start_configure | ( | struct Adxl345_Spi * | adxl | ) |
Definition at line 108 of file adxl345_spi.c.
References adxl345_spi_send_config(), ADXL_CONF_UNINIT, Adxl345_Spi::init_status, Adxl345_Spi::spi_trans, SPITransDone, SPITransSuccess, and spi_transaction::status.
Referenced by adxl345_spi_periodic().