Device driver for the LSM303DLHC 3D accelerometer/magnetometer. More...
Device driver for the LSM303DLHC 3D accelerometer/magnetometer.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.
| Files | |
| file | lsm303dlhc.h | 
| Device driver interface for the LSM303DLHC 3D accelerometer/magnetometer. | |
| file | lsm303dlhc-internal.h | 
| Definitions for the LSM303DLHC 3D accelerometer/magnetometer. | |
| file | lsm303dlhc_params.h | 
| Default configuration for LSM303DLHC devices. | |
| 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... | |
| Functions | |
| int | lsm303dlhc_init (lsm303dlhc_t *dev, const lsm303dlhc_params_t *params) | 
| Initialize a new LSM303DLHC device.  More... | |
| int | lsm303dlhc_read_acc (const lsm303dlhc_t *dev, lsm303dlhc_3d_data_t *data) | 
| Read a accelerometer value from the sensor.  More... | |
| int | lsm303dlhc_read_mag (const lsm303dlhc_t *dev, lsm303dlhc_3d_data_t *data) | 
| Read a magnetometer value from the sensor.  More... | |
| int | lsm303dlhc_read_temp (const lsm303dlhc_t *dev, int16_t *value) | 
| Read a temperature value from the sensor.  More... | |
| int | lsm303dlhc_enable (const lsm303dlhc_t *dev) | 
| Enable the given sensor.  More... | |
| int | lsm303dlhc_disable (const lsm303dlhc_t *dev) | 
| Disable the given sensor.  More... | |
| The sensors default I2C address | |
| #define | LSM303DLHC_ACC_DEFAULT_ADDRESS (0x19) | 
| #define | LSM303DLHC_MAG_DEFAULT_ADDRESS (0x1e) | 
Possible accelerometer sample rates.
Definition at line 46 of file lsm303dlhc.h.
Possible accelerometer scales.
| Enumerator | |
|---|---|
| LSM303DLHC_ACC_SCALE_2G | +- 2g range | 
| LSM303DLHC_ACC_SCALE_4G | +- 4g range | 
| LSM303DLHC_ACC_SCALE_8G | +- 8g range | 
| LSM303DLHC_ACC_SCALE_16G | +-16g range | 
Definition at line 62 of file lsm303dlhc.h.
Possible magnetometer gain values.
Definition at line 86 of file lsm303dlhc.h.
Possible magnetometer sample rates.
Definition at line 72 of file lsm303dlhc.h.
| int lsm303dlhc_disable | ( | const lsm303dlhc_t * | dev | ) | 
Disable the given sensor.
| [in] | dev | device descriptor of an LSM303DLHC device | 
| int lsm303dlhc_enable | ( | const lsm303dlhc_t * | dev | ) | 
Enable the given sensor.
| [in] | dev | device descriptor of an LSM303DLHC device | 
| int lsm303dlhc_init | ( | lsm303dlhc_t * | dev, | 
| const lsm303dlhc_params_t * | params | ||
| ) | 
Initialize a new LSM303DLHC device.
| [in] | dev | device descriptor of an LSM303DLHC device | 
| [in] | params | initialization parameters | 
| int lsm303dlhc_read_acc | ( | const lsm303dlhc_t * | dev, | 
| lsm303dlhc_3d_data_t * | data | ||
| ) | 
Read a accelerometer value from the sensor.
This function provides raw acceleration data. To get the corresponding values in g please refer to the following table: measurement range | factor -----------------—+------— +- 2g | 1*10^-3 +- 4g | 2*10^-3 +- 8g | 4*10^-3 +-16g | 8*10^-3
| [in] | dev | device descriptor of an LSM303DLHC device | 
| [out] | data | the measured accelerometer data | 
| int lsm303dlhc_read_mag | ( | const lsm303dlhc_t * | dev, | 
| lsm303dlhc_3d_data_t * | data | ||
| ) | 
Read a magnetometer value from the sensor.
This function returns raw magnetic data. To get the corresponding values in gauss please refer to the following table: measurement range | factor -----------------—+------— +- 1.3 gauss | 1/1100 +- 1.9 gauss | 1/855 +- 2.5 gauss | 1/670 +- 4.0 gauss | 1/450 +- 4.7 gauss | 1/400 +- 5.6 gauss | 1/330 +- 8.1 gauss | 1/230
| [in] | dev | device descriptor of an LSM303DLHC device | 
| [out] | data | the measured magnetometer data | 
| int lsm303dlhc_read_temp | ( | const lsm303dlhc_t * | dev, | 
| int16_t * | value | ||
| ) | 
Read a temperature value from the sensor.
| [in] | dev | device descriptor of an LSM303DLHC device | 
| [out] | value | the measured temperature |