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