lis2dh12.h¶
Interface definition for the STM LIS2DH12 accelerometer.
-
enum
lis2dh12_scale_t
¶ - LIS2DH12_SCALE_2G
= 0x00
- +- 2g
- LIS2DH12_SCALE_4G
= 0x10
- +- 4g
- LIS2DH12_SCALE_8G
= 0x20
- +- 8g
- LIS2DH12_SCALE_16G
= 0x30
- +- 16g
- LIS2DH12_SCALE_2G
-
enum
lis2dh12_rate_t
¶ - LIS2DH12_RATE_1HZ
= 0x17
- sample with 1Hz
- LIS2DH12_RATE_10HZ
= 0x27
- sample with 10Hz
- LIS2DH12_RATE_25HZ
= 0x37
- sample with 25Hz
- LIS2DH12_RATE_50HZ
= 0x47
- sample with 50Hz
- LIS2DH12_RATE_100HZ
= 0x57
- sample with 100Hz
- LIS2DH12_RATE_200HZ
= 0x67
- sample with 200Hz
- LIS2DH12_RATE_400HZ
= 0x77
- sample with 400Hz
- LIS2DH12_RATE_1HZ
-
enum
@126
¶ - LIS2DH12_OK
= 0
- everything was fine
- LIS2DH12_NOBUS
= -1
- bus interface error
- LIS2DH12_NODEV
= -2
- unable to talk to device
- LIS2DH12_OK
-
const saul_driver_t
lis2dh12_saul_driver
¶ Export the SAUL interface for this driver.
-
int
lis2dh12_init
(lis2dh12_t * dev, const lis2dh12_params_t * params)¶ Initialize the given LIS2DH12 sensor device.
Parameters
dev: device descriptor params: static device configuration Return values
- LIS2DH12_OK on success
- LIS2DH12_NOBUS on bus errors
- LIS2DH12_NODEV if no LIS2DH12 device was found on the bus
-
int
lis2dh12_read
(const lis2dh12_t * dev, int16_t * data)¶ Read acceleration data from the given device.
Parameters
dev: device descriptor data: acceleration data in mili-g, MUST hold 3 values Return values
- LIS2DH12_OK on success
- LIS2DH12_NOBUS on bus error
-
int
lis2dh12_poweron
(const lis2dh12_t * dev)¶ Power on the given device.
Parameters
dev: device descriptor Return values
- LIS2DH12_OK on success
- LIS2DH12_NOBUS on bus error
-
int
lis2dh12_poweroff
(const lis2dh12_t * dev)¶ Power off the given device.
Parameters
dev: device descriptor Return values
- LIS2DH12_OK on success
- LIS2DH12_NOBUS on bus error
-
struct
lis2dh12_params_t
¶ LIS2DH12 configuration parameters.
-
spi.h::spi_t
spi
¶ SPI bus the device is connected to.
-
gpio.h::gpio_t
cs
¶ connected chip select pin
-
lis2dh12.h::lis2dh12_scale_t
scale
¶ sampling sensitivity used
-
lis2dh12.h::lis2dh12_rate_t
rate
¶ sampling rate used
-
-
struct
lis2dh12_t
¶ LIS2DH12 device descriptor.
-
const lis2dh12_params_t *
p
¶ device configuration
-
uint16_t
comp
¶ scale compensation factor
-
const lis2dh12_params_t *