Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
lsm303dlhc_i2c.c File Reference
#include "peripherals/lsm303dlhc_i2c.h"
#include "std.h"
+ Include dependency graph for lsm303dlhc_i2c.c:

Go to the source code of this file.

Macros

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

Functions

void lsm303dlhc_i2c_init (struct Lsm303dlhc_i2c *lsm, struct i2c_periph *i2c_p, uint8_t addr)
 Initialize Lsm303dlhc struct and set default config options. More...
 
static void lsm303dlhc_i2c_tx_reg (struct Lsm303dlhc_I2c *lsm, uint8_t reg, uint8_t val)
 
static void lsm303dlhc_i2c_send_config (struct Lsm303dlhc_I2c *lsm)
 Configuration function called once before normal use. More...
 
void lsm303dlhc_i2c_start_configure (struct Lsm303dlhc_I2c *lsm)
 
void lsm303dlhc_i2c_read (struct Lsm303dlhc *lsm)
 
void lsm303dlhc_i2c_event (struct Lsm303dlhc *lsm)
 

Detailed Description

Driver for ST LSM303DLHC 3D accelerometer and magnetometer. UNTESTED

Definition in file lsm303dlhc_i2c.c.

Macro Definition Documentation

◆ Int16FromBuf

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

Definition at line 164 of file lsm303dlhc_i2c.c.

Function Documentation

◆ lsm303dlhc_i2c_event()

void lsm303dlhc_i2c_event ( struct Lsm303dlhc *  lsm)

◆ lsm303dlhc_i2c_init()

void lsm303dlhc_i2c_init ( struct Lsm303dlhc_i2c lsm,
struct i2c_periph i2c_p,
uint8_t  addr 
)

Initialize Lsm303dlhc struct and set default config options.

Parameters
lsmLsm303dlhc struct
i2c_pI2C peripheral to use
addrI2C address of Lsm303dlhc

Definition at line 39 of file lsm303dlhc_i2c.c.

References Lsm303dlhc_i2c::config, Lsm303dlhc_i2c::i2c_p, Lsm303dlhc_i2c::i2c_trans, I2CTransDone, Lsm303dlhc_i2c::init_status, Lsm303dlhc_i2c::initialized, LSM303DLHC_ACC_ADDR, lsm303dlhc_acc_set_default_config(), lsm303dlhc_mag_set_default_config(), i2c_transaction::slave_addr, and i2c_transaction::status.

+ Here is the call graph for this function:

◆ lsm303dlhc_i2c_read()

void lsm303dlhc_i2c_read ( struct Lsm303dlhc *  lsm)

Definition at line 142 of file lsm303dlhc_i2c.c.

References i2c_submit(), I2CTransDone, I2CTransTxRx, LSM303DLHC_ACC_ADDR, LSM303DLHC_REG_OUT_X_H_M, and LSM303DLHC_REG_OUT_X_L_A.

Referenced by lsm303dlhc_i2c_send_config().

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

◆ lsm303dlhc_i2c_send_config()

static void lsm303dlhc_i2c_send_config ( struct Lsm303dlhc_I2c *  lsm)
static

Configuration function called once before normal use.

Definition at line 68 of file lsm303dlhc_i2c.c.

References I2CTransDone, LSM303DLHC_ACC_ADDR, LSM303DLHC_FS_MASK, lsm303dlhc_i2c_read(), lsm303dlhc_i2c_tx_reg(), LSM303DLHC_Xen, LSM303DLHC_Yen, and LSM303DLHC_Zen.

Referenced by lsm303dlhc_i2c_start_configure().

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

◆ lsm303dlhc_i2c_start_configure()

void lsm303dlhc_i2c_start_configure ( struct Lsm303dlhc_I2c *  lsm)

Definition at line 122 of file lsm303dlhc_i2c.c.

References I2CTransDone, I2CTransSuccess, LSM303DLHC_ACC_ADDR, and lsm303dlhc_i2c_send_config().

+ Here is the call graph for this function:

◆ lsm303dlhc_i2c_tx_reg()

static void lsm303dlhc_i2c_tx_reg ( struct Lsm303dlhc_I2c *  lsm,
uint8_t  reg,
uint8_t  val 
)
static

Definition at line 57 of file lsm303dlhc_i2c.c.

References i2c_submit(), I2CTransTx, and val.

Referenced by lsm303dlhc_i2c_send_config().

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