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
lsm303d_spi.c File Reference

Driver for ST LSM303D 3D accelerometer and magnetometer. More...

#include "peripherals/lsm303d_spi.h"
#include "std.h"
+ Include dependency graph for lsm303d_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 lsm303d_spi_init (struct Lsm303d_Spi *lsm, struct spi_periph *spi_p, uint8_t slave_idx, enum Lsm303dTarget target)
 
static void lsm303d_spi_tx_reg (struct Lsm303d_Spi *lsm, uint8_t reg, uint8_t val)
 
static void lsm303d_spi_send_config (struct Lsm303d_Spi *lsm)
 Configuration function called once before normal use.
 
void lsm303d_spi_start_configure (struct Lsm303d_Spi *lsm)
 
void lsm303d_spi_read (struct Lsm303d_Spi *lsm)
 
void lsm303d_spi_event (struct Lsm303d_Spi *lsm)
 

Detailed Description

Driver for ST LSM303D 3D accelerometer and magnetometer.

Definition in file lsm303d_spi.c.

Macro Definition Documentation

◆ Int16FromBuf

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

Definition at line 172 of file lsm303d_spi.c.

Function Documentation

◆ lsm303d_spi_event()

void lsm303d_spi_event ( struct Lsm303d_Spi lsm)

Definition at line 176 of file lsm303d_spi.c.

References foo, Int16FromBuf, LSM303D_CONF_UNINIT, lsm303d_spi_send_config(), LSM303D_TARGET_ACC, LSM303D_ZYXADA, LSM303D_ZYXMDA, SPITransDone, SPITransFailed, SPITransSuccess, and TRUE.

Referenced by imu_px4_event().

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

◆ lsm303d_spi_init()

void lsm303d_spi_init ( struct Lsm303d_Spi lsm,
struct spi_periph spi_p,
uint8_t  slave_idx,
enum Lsm303dTarget  target 
)

Definition at line 32 of file lsm303d_spi.c.

References FALSE, foo, LSM303D_CONF_UNINIT, lsm303d_set_default_config(), SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, and target.

Referenced by imu_px4_init().

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

◆ lsm303d_spi_read()

void lsm303d_spi_read ( struct Lsm303d_Spi lsm)

Definition at line 151 of file lsm303d_spi.c.

References foo, LSM303D_REG_STATUS_A, LSM303D_REG_STATUS_M, LSM303D_TARGET_ACC, spi_submit(), and SPITransDone.

Referenced by lsm303d_spi_periodic().

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

◆ lsm303d_spi_send_config()

◆ lsm303d_spi_start_configure()

void lsm303d_spi_start_configure ( struct Lsm303d_Spi lsm)

Definition at line 140 of file lsm303d_spi.c.

References foo, LSM303D_CONF_UNINIT, lsm303d_spi_send_config(), SPITransDone, and SPITransSuccess.

Referenced by lsm303d_spi_periodic().

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

◆ lsm303d_spi_tx_reg()

static void lsm303d_spi_tx_reg ( struct Lsm303d_Spi lsm,
uint8_t  reg,
uint8_t  val 
)
static

Definition at line 70 of file lsm303d_spi.c.

References foo, spi_submit(), and val.

Referenced by lsm303d_spi_send_config().

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