Loading...
Searching...
No Matches

Device driver interface for the LSM303DLHC 3D accelerometer/magnetometer. More...

Detailed Description

Device driver interface for the LSM303DLHC 3D accelerometer/magnetometer.

Author
Thomas Eichinger thoma.nosp@m.s.ei.nosp@m.ching.nosp@m.er@f.nosp@m.u-ber.nosp@m.lin..nosp@m.de

Definition in file lsm303dlhc.h.

#include <stdint.h>
#include "periph/i2c.h"
#include "periph/gpio.h"
+ Include dependency graph for lsm303dlhc.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lsm303dlhc_3d_data_t
 3d data container More...
 
struct  lsm303dlhc_params_t
 Data structure holding all the information needed for initialization. More...
 
struct  lsm303dlhc_t
 Device descriptor for LSM303DLHC sensors. More...
 

Enumerations

enum  lsm303dlhc_acc_sample_rate_t {
  LSM303DLHC_ACC_SAMPLE_RATE_1HZ = 0x10 , LSM303DLHC_ACC_SAMPLE_RATE_10HZ = 0x20 , LSM303DLHC_ACC_SAMPLE_RATE_25HZ = 0x30 , LSM303DLHC_ACC_SAMPLE_RATE_50HZ = 0x40 ,
  LSM303DLHC_ACC_SAMPLE_RATE_100HZ = 0x50 , LSM303DLHC_ACC_SAMPLE_RATE_200HZ = 0x60 , LSM303DLHC_ACC_SAMPLE_RATE_400HZ = 0x70 , LSM303DLHC_ACC_SAMPLE_RATE_1620HZ = 0x80 ,
  LSM303DLHC_ACC_SAMPLE_RATE_N1344HZ_L5376HZ = 0x90
}
 Possible accelerometer sample rates. More...
 
enum  lsm303dlhc_acc_scale_t { LSM303DLHC_ACC_SCALE_2G = 0x00 , LSM303DLHC_ACC_SCALE_4G = 0x10 , LSM303DLHC_ACC_SCALE_8G = 0x20 , LSM303DLHC_ACC_SCALE_16G = 0x30 }
 Possible accelerometer scales. More...
 
enum  lsm303dlhc_mag_sample_rate_t {
  LSM303DLHC_MAG_SAMPLE_RATE_0_75HZ = 0x00 , LSM303DLHC_MAG_SAMPLE_RATE_1_5HZ = 0x04 , LSM303DLHC_MAG_SAMPLE_RATE_3HZ = 0x08 , LSM303DLHC_MAG_SAMPLE_RATE_7_5HZ = 0x0c ,
  LSM303DLHC_MAG_SAMPLE_RATE_15HZ = 0x10 , LSM303DLHC_MAG_SAMPLE_RATE_30HZ = 0x14 , LSM303DLHC_MAG_SAMPLE_RATE_75HZ = 0x18 , LSM303DLHC_MAG_SAMPLE_RATE_220HZ = 0x1c
}
 Possible magnetometer sample rates. More...
 
enum  lsm303dlhc_mag_gain_t {
  LSM303DLHC_MAG_GAIN_1100_980_GAUSS = 0x20 , LSM303DLHC_MAG_GAIN_855_760_GAUSS = 0x40 , LSM303DLHC_MAG_GAIN_670_600_GAUSS = 0x60 , LSM303DLHC_MAG_GAIN_450_400_GAUSS = 0x80 ,
  LSM303DLHC_MAG_GAIN_400_355_GAUSS = 0xa0 , LSM303DLHC_MAG_GAIN_330_295_GAUSS = 0xc0 , LSM303DLHC_MAG_GAIN_230_205_GAUSS = 0xe0
}
 Possible magnetometer gain values. More...
 

Functions

int lsm303dlhc_init (lsm303dlhc_t *dev, const lsm303dlhc_params_t *params)
 Initialize a new LSM303DLHC device.
 
int lsm303dlhc_read_acc (const lsm303dlhc_t *dev, lsm303dlhc_3d_data_t *data)
 Read a accelerometer value from the sensor.
 
int lsm303dlhc_read_mag (const lsm303dlhc_t *dev, lsm303dlhc_3d_data_t *data)
 Read a magnetometer value from the sensor.
 
int lsm303dlhc_read_temp (const lsm303dlhc_t *dev, int16_t *value)
 Read a temperature value from the sensor.
 
int lsm303dlhc_enable (const lsm303dlhc_t *dev)
 Enable the given sensor.
 
int lsm303dlhc_disable (const lsm303dlhc_t *dev)
 Disable the given sensor.
 

The sensors default I2C address

#define LSM303DLHC_ACC_DEFAULT_ADDRESS   (0x19)
 
#define LSM303DLHC_MAG_DEFAULT_ADDRESS   (0x1e)