Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces 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

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

Definition at line 131 of file adxl345_spi.c.

References adxl345_spi_send_config(), ADXL_CONF_UNINIT, foo, Int16FromBuf, SPITransDone, SPITransFailed, and SPITransSuccess.

Referenced by imu_aspirin_event().

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

◆ adxl345_spi_init()

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, foo, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, and spi_periph::status.

Referenced by imu_aspirin_init().

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

◆ 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, foo, spi_submit(), and SPITransDone.

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

static void adxl345_spi_send_config ( struct Adxl345_Spi adxl)
static

◆ 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, foo, SPITransDone, and SPITransSuccess.

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 foo, and spi_submit().

Referenced by adxl345_spi_send_config().

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