Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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

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

Definition at line 128 of file adxl345_spi.c.

Referenced by adxl345_spi_event().

Function Documentation

void adxl345_spi_read ( struct Adxl345_Spi adxl)

Definition at line 117 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:

void adxl345_spi_start_configure ( struct Adxl345_Spi adxl)

Definition at line 107 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:

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: