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

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

#include "std.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/spi.h"
#include "peripherals/adxl345.h"
+ Include dependency graph for adxl345_spi.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Adxl345_Spi
 
union  Adxl345_Spi.data
 

Functions

void adxl345_spi_init (struct Adxl345_Spi *adxl, struct spi_periph *spi_p, uint8_t addr)
 
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)
 
static void adxl345_spi_periodic (struct Adxl345_Spi *adxl)
 convenience function: read or start configuration if not already initialized More...
 

Detailed Description

Driver for the accelerometer ADXL345 from Analog Devices using SPI.

Definition in file adxl345_spi.h.


Data Structure Documentation

◆ Adxl345_Spi

struct Adxl345_Spi

Definition at line 39 of file adxl345_spi.h.

+ Collaboration diagram for Adxl345_Spi:
Data Fields
struct Adxl345Config config
union Adxl345_Spi data
volatile bool data_available data ready flag
enum Adxl345ConfStatus init_status init status
bool initialized config done flag
volatile uint8_t rx_buf[7]
struct spi_periph * spi_p
struct spi_transaction spi_trans
volatile uint8_t tx_buf[7]

◆ Adxl345_Spi.data

union Adxl345_Spi.data

Definition at line 47 of file adxl345_spi.h.

Data Fields
int16_t value[3] data values accessible by channel index
struct Int16Vect3 vect data vector in accel coordinate system

Function Documentation

◆ adxl345_spi_event()

void adxl345_spi_event ( struct Adxl345_Spi adxl)

◆ adxl345_spi_init()

◆ adxl345_spi_periodic()

static void adxl345_spi_periodic ( struct Adxl345_Spi adxl)
inlinestatic

convenience function: read or start configuration if not already initialized

Definition at line 61 of file adxl345_spi.h.

References adxl345_spi_read(), adxl345_spi_start_configure(), and Adxl345_Spi::initialized.

Referenced by imu_aspirin_periodic().

+ 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, 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_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: