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 "peripherals/adxl345_spi.h"
Go to the source code of this file.
Macros | |
#define | Int16FromBuf(_buf, _idx) ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx])) |
Functions | |
void | adxl345_spi_init (struct Adxl345_Spi *adxl, struct spi_periph *spi_p, uint8_t slave_idx) |
static void | adxl345_spi_write_to_reg (struct Adxl345_Spi *adxl, uint8_t _reg, uint8_t _val) |
static void | adxl345_spi_send_config (struct Adxl345_Spi *adxl) |
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) |
Driver for the accelerometer ADXL345 from Analog Devices using SPI.
Definition in file adxl345_spi.c.
#define Int16FromBuf | ( | _buf, | |
_idx | |||
) | ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx])) |
Definition at line 129 of file adxl345_spi.c.
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 | slave_idx | ||
) |
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().
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().
|
static |
Definition at line 79 of file adxl345_spi.c.
References adxl345_data_format(), ADXL345_REG_BW_RATE, ADXL345_REG_DATA_FORMAT, ADXL345_REG_INT_ENABLE, ADXL345_REG_POWER_CTL, adxl345_spi_write_to_reg(), ADXL_CONF_DONE, ADXL_CONF_ENABLE, ADXL_CONF_FORMAT, ADXL_CONF_INT, ADXL_CONF_RATE, Adxl345_Spi::config, Adxl345Config::drdy_int_enable, Adxl345_Spi::init_status, Adxl345_Spi::initialized, Adxl345Config::rate, Adxl345_Spi::spi_trans, SPITransDone, and spi_transaction::status.
Referenced by adxl345_spi_event(), and adxl345_spi_start_configure().
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().
|
static |
Definition at line 69 of file adxl345_spi.c.
References spi_transaction::input_length, spi_transaction::output_length, Adxl345_Spi::spi_p, spi_submit(), Adxl345_Spi::spi_trans, and Adxl345_Spi::tx_buf.
Referenced by adxl345_spi_send_config().