Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
adxl345_spi.c File Reference

Driver for the accelerometer ADXL345 from Analog Devices using SPI. More...

+ Include dependency graph for adxl345_spi.c:

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)
 

Detailed Description

Driver for the accelerometer ADXL345 from Analog Devices using SPI.

Todo:
Use SPICallback to copy data from rx_buf when transaction is successful, instead of checking transaction status for SPITransSuccess in event loop. Problem is that in the callback we don't have a reference to the Adxl345_Spi struct.

Definition in file adxl345_spi.c.

Macro Definition Documentation

◆ Int16FromBuf

#define Int16FromBuf (   _buf,
  _idx 
)    ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx]))

Definition at line 129 of file adxl345_spi.c.

Function Documentation

◆ adxl345_spi_event()

void adxl345_spi_event ( struct Adxl345_Spi adxl)

◆ adxl345_spi_init()

◆ adxl345_spi_read()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adxl345_spi_send_config()

◆ 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adxl345_spi_write_to_reg()

static void adxl345_spi_write_to_reg ( struct Adxl345_Spi adxl,
uint8_t  _reg,
uint8_t  _val 
)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: