129 #define Int16FromBuf(_buf,_idx) ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx]))
enum SPIClockPolarity cpol
clock polarity control
struct Adxl345Config config
enum SPIClockDiv cdiv
prescaler of main clock to use as SPI clock
static uint8_t adxl345_data_format(struct Adxl345Config *c)
uint16_t output_length
number of data words to write
volatile uint8_t tx_buf[7]
volatile uint8_t rx_buf[7]
#define Int16FromBuf(_buf, _idx)
enum Adxl345Rates rate
Data Output Rate.
bool_t drdy_int_enable
Enable Data Ready Interrupt.
bool_t initialized
config done flag
enum Adxl345ConfStatus init_status
init status
enum SPIBitOrder bitorder
MSB/LSB order.
union Adxl345_Spi::@25 data
#define ADXL345_REG_INT_ENABLE
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
enum SPISlaveSelect select
slave selection behavior
struct spi_transaction spi_trans
enum SPIClockPhase cpha
clock phase control
static void adxl345_spi_write_to_reg(struct Adxl345_Spi *adxl, uint8_t _reg, uint8_t _val)
Driver for the accelerometer ADXL345 from Analog Devices using SPI.
SPI peripheral structure.
volatile bool_t data_available
data ready flag
#define ADXL345_REG_BW_RATE
void adxl345_spi_event(struct Adxl345_Spi *adxl)
bool_t spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit a spi transaction.
SPICallback after_cb
NULL or function called after the transaction.
struct spi_periph * spi_p
#define ADXL345_REG_DATA_FORMAT
void adxl345_spi_init(struct Adxl345_Spi *adxl, struct spi_periph *spi_p, uint8_t slave_idx)
uint16_t input_length
number of data words to read
static void adxl345_spi_send_config(struct Adxl345_Spi *adxl)
static void adxl345_set_default_config(struct Adxl345Config *c)
slave is selected before transaction and unselected after
enum SPIDataSizeSelect dss
data transfer word size
void adxl345_spi_start_configure(struct Adxl345_Spi *adxl)
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
#define ADXL345_REG_POWER_CTL
volatile uint8_t * input_buf
pointer to receive buffer for DMA
SPICallback before_cb
NULL or function called before the transaction.
#define ADXL345_REG_DATA_X0
enum SPITransactionStatus status
void adxl345_spi_read(struct Adxl345_Spi *adxl)