Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
lsm303dlhc.c File Reference

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

#include "peripherals/lsm303dlhc.h"
#include "std.h"
+ Include dependency graph for lsm303dlhc.c:

Go to the source code of this file.

Macros

#define LSM303DLHC_DEFAULT_ODR   0x90
 
#define LSM303DLHC_DEFAULT_LP   0x00
 
#define LSM303DLHC_DEFAULT_FS   0x00
 
#define LSM303DLHC_DEFAULT_HR   0x04
 
#define LSM303DLHC_DEFAULT_DO   (0x6 << 2)
 
#define LSM303DLHC_DEFAULT_GN   (0x1 << 5)
 
#define LSM303DLHC_DEFAULT_MD   0x00
 
#define Int16FromBuf(_buf, _idx)   ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx]))
 

Functions

static void lsm303dlhc_acc_set_default_config (struct Lsm303dlhcAccConfig *c)
 
static void lsm303dlhc_mag_set_default_config (struct Lsm303dlhcMagConfig *c)
 
void lsm303dlhc_init (struct Lsm303dlhc *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 *lsm, uint8_t reg, uint8_t val)
 
static void lsm303dlhc_send_config (struct Lsm303dlhc *lsm)
 Configuration function called once before normal use. More...
 
void lsm303dlhc_start_configure (struct Lsm303dlhc *lsm)
 
void lsm303dlhc_read (struct Lsm303dlhc *lsm)
 
void lsm303dlhc_event (struct Lsm303dlhc *lsm)
 

Detailed Description

Driver for ST LSM303DLHC 3D accelerometer and magnetometer.

Definition in file lsm303dlhc.c.

Macro Definition Documentation

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

Definition at line 208 of file lsm303dlhc.c.

Referenced by lsm303dlhc_event().

#define LSM303DLHC_DEFAULT_DO   (0x6 << 2)

Definition at line 50 of file lsm303dlhc.c.

Referenced by lsm303dlhc_mag_set_default_config().

#define LSM303DLHC_DEFAULT_FS   0x00

Definition at line 42 of file lsm303dlhc.c.

Referenced by lsm303dlhc_acc_set_default_config().

#define LSM303DLHC_DEFAULT_GN   (0x1 << 5)

Definition at line 54 of file lsm303dlhc.c.

Referenced by lsm303dlhc_mag_set_default_config().

#define LSM303DLHC_DEFAULT_HR   0x04

Definition at line 46 of file lsm303dlhc.c.

Referenced by lsm303dlhc_acc_set_default_config(), and lsm303dlhc_send_config().

#define LSM303DLHC_DEFAULT_LP   0x00

Definition at line 38 of file lsm303dlhc.c.

Referenced by lsm303dlhc_acc_set_default_config().

#define LSM303DLHC_DEFAULT_MD   0x00

Definition at line 58 of file lsm303dlhc.c.

Referenced by lsm303dlhc_mag_set_default_config().

#define LSM303DLHC_DEFAULT_ODR   0x90

Definition at line 34 of file lsm303dlhc.c.

Referenced by lsm303dlhc_acc_set_default_config().

Function Documentation

static void lsm303dlhc_acc_set_default_config ( struct Lsm303dlhcAccConfig c)
static
static void lsm303dlhc_i2c_tx_reg ( struct Lsm303dlhc lsm,
uint8_t  reg,
uint8_t  val 
)
static

Definition at line 100 of file lsm303dlhc.c.

References i2c_transaction::buf, Lsm303dlhc::i2c_p, i2c_submit(), Lsm303dlhc::i2c_trans, I2CTransTx, i2c_transaction::len_r, i2c_transaction::len_w, i2c_transaction::type, and val.

Referenced by lsm303dlhc_send_config().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void lsm303dlhc_init ( struct Lsm303dlhc lsm,
struct i2c_periph i2c_p,
uint8_t  addr 
)
static void lsm303dlhc_mag_set_default_config ( struct Lsm303dlhcMagConfig c)
static
void lsm303dlhc_start_configure ( struct Lsm303dlhc lsm)