Go to the documentation of this file.
44 #ifdef MODULE_LIS2DH12_SPI
54 #if defined(MODULE_LIS2DH12) || defined(DOXYGEN)
58 #define LIS2DH12_ADDR_DEFAULT (0x19)
91 #if MODULE_LIS2DH12_SPI || DOXYGEN
98 #if MODULE_LIS2DH12_INT || DOXYGEN
125 #if MODULE_LIS2DH12_INT || DOXYGEN
184 #define LIS2DH12_INT_SRC_XL (0x01)
185 #define LIS2DH12_INT_SRC_XH (0x02)
186 #define LIS2DH12_INT_SRC_YL (0x04)
187 #define LIS2DH12_INT_SRC_YH (0x08)
188 #define LIS2DH12_INT_SRC_ZL (0x10)
189 #define LIS2DH12_INT_SRC_ZH (0x20)
190 #define LIS2DH12_INT_SRC_IA (0x40)
196 #define LIS2DH12_STATUS_XDA (0x01)
197 #define LIS2DH12_STATUS_YDA (0x02)
198 #define LIS2DH12_STATUS_ZDA (0x04)
199 #define LIS2DH12_STATUS_ZYXDA (0x08)
200 #define LIS2DH12_STATUS_XOR (0x10)
201 #define LIS2DH12_STATUS_YOR (0x20)
202 #define LIS2DH12_STATUS_ZOR (0x40)
203 #define LIS2DH12_STATUS_ZYXOR (0x80)
208 extern const saul_driver_t lis2dh12_saul_driver;
210 #if MODULE_LIS2DH12_INT || DOXYGEN
@ LIS2DH12_INT_CFG_YHIE
enable Y high event
@ LIS2DH12_NODEV
unable to talk to device
@ LIS2DH12_INT_CFG_AOI
and/or combination interrupt events
@ LIS2DH12_INT_TYPE_I1_IA2
IA2 interrupt on INT1.
@ LIS2DH12_INT_CFG_ZLIE
enable Z low event
int lis2dh12_init(lis2dh12_t *dev, const lis2dh12_params_t *params)
Initialize the given LIS2DH12 sensor device.
@ LIS2DH12_NODATA
no data available
Low-level SPI peripheral driver interface definition.
LIS2DH12 configuration parameters.
uint8_t int_type
values for type of interrupts
unsigned int i2c_t
Default i2c_t type definition.
int lis2dh12_set_int(const lis2dh12_t *dev, const lis2dh12_int_params_t *params, uint8_t int_line)
Set the interrupt values in LIS2DH12 sensor device.
lis2dh12_rate_t rate
sampling rate used
@ LIS2DH12_OK
everything was fine
@ LIS2DH12_INT_TYPE_I1_IA1
IA1 interrupt on INT1.
@ LIS2DH12_INT_TYPE_I2_IA1
IA1 on INT2.
gpio_t int2_pin
second interrupt pin
@ LIS2DH12_INT_TYPE_I2_CLICK
click interrupt on INT2
uint8_t int_duration
time between two interrupts ODR section in CTRL_REG1, duration in range 0-127
@ LIS2DH12_INT_TYPE_I2_ACT
enable activity interrupt on INT2
uint8_t int_threshold
the threshold for triggering interrupt, threshold in range 0-127
Parameter for interrupt configuration.
lis2dh12_rate_t
Available sampling rates.
spi_t spi
SPI bus the device is connected to.
@ LIS2DH12_INT_TYPE_I2_BOOT
enable boot on INT2
@ LIS2DH12_INT_TYPE_I1_ZYXDA
ZYXDA interrupt on INT1.
void * arg
the callback argument
@ LIS2DH12_RATE_1HZ
sample with 1Hz
@ LIS2DH12_RATE_25HZ
sample with 25Hz
int lis2dh12_poweron(const lis2dh12_t *dev)
Power on the given device.
@ LIS2DH12_RATE_200HZ
sample with 200Hz
LIS2DH12 device descriptor.
@ LIS2DH12_INT_TYPE_INT_POLARITY
INT1 and INT2 pin polarity.
uint16_t comp
scale compensation factor
lis2dh12_scale_t scale
sampling sensitivity used
@ LIS2DH12_RATE_10HZ
sample with 10Hz
@ LIS2DH12_INT_CFG_YLIE
enable Y low event
int lis2dh12_read(const lis2dh12_t *dev, int16_t *data)
Read acceleration data from the given device.
lis2dh12_scale_t
Available scale values.
@ LIS2DH12_INT_CFG_ZHIE
enable Z high event
@ LIS2DH12_INT_CFG_XHIE
enable X high event
gpio_cb_t cb
the callback to execute
@ LIS2DH12_INT2
second interrupt line
gpio_t int1_pin
first interrupt pin
@ LIS2DH12_INT_CFG_6D
enable 6-direction detection
@ LIS2DH12_SCALE_16G
+- 16g
void(* gpio_cb_t)(void *arg)
Signature of event callback functions triggered from interrupts.
@ LIS2DH12_RATE_400HZ
sample with 400Hz
@ LIS2DH12_RATE_100HZ
sample with 100Hz
@ LIS2DH12_INT_TYPE_I1_OVERRUN
FIFO overrun interrupt on INT1.
@ LIS2DH12_INT_CFG_XLIE
enable X low evnt
Low-level GPIO peripheral driver interface definitions.
uint8_t int_config
values for configuration
@ LIS2DH12_NOINT
wrong interrupt line (has to be LIS2DH12_INT1 or LIS2DH12_INT2)
@ LIS2DH12_INT_TYPE_I1_WTM
FIFO watermark inter.
Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer.
const lis2dh12_params_t * p
device configuration
@ LIS2DH12_INT1
first interrupt line
@ LIS2DH12_RATE_50HZ
sample with 50Hz
int lis2dh12_read_int_src(const lis2dh12_t *dev, uint8_t *data, uint8_t int_line)
Read an interrupt event on LIS2DH12 sensor device.
@ LIS2DH12_NOBUS
bus interface error
@ LIS2DH12_INT_TYPE_I1_CLICK
click interrupt on INT1
gpio_t cs
connected chip select pin
int lis2dh12_poweroff(const lis2dh12_t *dev)
Power off the given device.
Low-level I2C peripheral driver interface definition.
@ LIS2DH12_INT_TYPE_I2_IA2
IA2 on INT2.
unsigned int spi_t
Default type for SPI devices.