Interface definition for the STM LIS2DH12 accelerometer. More...
Interface definition for the STM LIS2DH12 accelerometer.
Definition in file lis2dh12.h.
#include <stdint.h>
#include <stdbool.h>
#include "saul.h"
#include "lis2dh12_registers.h"
#include "periph/gpio.h"
#include "periph/i2c.h"
Go to the source code of this file.
Data Structures | |
struct | lis2dh12_params_t |
LIS2DH12 configuration parameters. More... | |
struct | lis2dh12_highpass_t |
LIS2DH12 high pass config values. More... | |
struct | lis2dh12_click_t |
LIS2DH12 click config values. More... | |
struct | lis2dh12_t |
LIS2DH12 device descriptor. More... | |
struct | lis2dh12_int_params_t |
Parameter for interrupt configuration. More... | |
union | lis2dh12_fifo_data_t |
LIS2DH12 FIFO data struct. More... | |
struct | lis2dh12_fifo_t |
LIS2DH12 FIFO config values. More... | |
Macros | |
#define | LIS2DH12_ADDR_DEFAULT (0x19) |
Default I2C slave address for LIS2DH12 devices. | |
#define | LIS2DH12_CLICK_X_SINGLE (1 << 0) |
single click on X axis | |
#define | LIS2DH12_CLICK_X_DOUBLE (1 << 1) |
double click on X axis | |
#define | LIS2DH12_CLICK_Y_SINGLE (1 << 2) |
single click on Y axis | |
#define | LIS2DH12_CLICK_Y_DOUBLE (1 << 3) |
double click on Y axis | |
#define | LIS2DH12_CLICK_Z_SINGLE (1 << 4) |
single click on Z axis | |
#define | LIS2DH12_CLICK_Z_DOUBLE (1 << 5) |
double click on Z axis | |
Functions | |
void | lis2dh12_cfg_threshold_event (const lis2dh12_t *dev, uint32_t mg, uint32_t us, uint8_t axis, uint8_t event, uint8_t pin) |
Configure a threshold event An Interrupt will be generated if acceleration exceeds the set threshold around the current reference value. | |
void | lis2dh12_cfg_click_event (const lis2dh12_t *dev, uint32_t mg, uint32_t us_limit, uint32_t us_latency, uint32_t us_window, uint8_t click, uint8_t pin) |
Configure a click event A click event is generated when the acceleration exceeds the set threshold for less than us_limit µs. | |
void | lis2dh12_cfg_disable_event (const lis2dh12_t *dev, uint8_t event, uint8_t pin) |
Disable interrupt generation for an event This disables an interrupt on pin if a previously configured event occurs. | |
int | lis2dh12_wait_event (const lis2dh12_t *dev, uint8_t pin, bool stale_events) |
Wait for an interrupt event This function will block until an interrupt is received. | |
int | lis2dh12_set_fifo (const lis2dh12_t *dev, const lis2dh12_fifo_t *config) |
Set the FIFO configuration. | |
int | lis2dh12_restart_fifo (const lis2dh12_t *dev) |
Restart the FIFO mode this sets the FIFO mode in BYPASS mode and then back to previous mode Note: The LIS module disables the FIFO after interrupt automatically, it is recommended to set the FIFO in BYPASS mode and then back to old FIFO mode to enable the FIFO again. | |
uint8_t | lis2dh12_read_fifo_data (const lis2dh12_t *dev, lis2dh12_fifo_data_t *fifo_data, uint8_t number) |
This function will read a given number of data from FIFO reads amount of data that is available in FIFO. | |
int | lis2dh12_init (lis2dh12_t *dev, const lis2dh12_params_t *params) |
Initialize the given LIS2DH12 sensor device. | |
int | lis2dh12_read (const lis2dh12_t *dev, lis2dh12_fifo_data_t *data) |
Read acceleration data from the given device. | |
int | lis2dh12_read_temperature (const lis2dh12_t *dev, int16_t *temp) |
Read temperature data from the given device. | |
int | lis2dh12_clear_data (const lis2dh12_t *dev) |
Clear the LIS2DH12 memory, clears all sampled data. | |
int | lis2dh12_set_scale (lis2dh12_t *dev, lis2dh12_scale_t scale) |
Change device measuring range. | |
lis2dh12_scale_t | lis2dh12_get_scale (lis2dh12_t *dev) |
Get device measuring range. | |
int | lis2dh12_set_datarate (const lis2dh12_t *dev, lis2dh12_rate_t rate) |
Change device sampling rate. | |
uint16_t | lis2dh12_get_datarate (const lis2dh12_t *dev) |
Get device sampling rate in Hz. | |
int | lis2dh12_set_resolution (const lis2dh12_t *dev, lis2dh12_resolution_t resolution) |
Change device resolution. | |
lis2dh12_resolution_t | lis2dh12_get_resolution (const lis2dh12_t *dev) |
Get device resolution. | |
int | lis2dh12_set_highpass (const lis2dh12_t *dev, const lis2dh12_highpass_t *config) |
Configures the high pass filter. | |
int | lis2dh12_set_reference (const lis2dh12_t *dev, uint8_t reference) |
Set the reference value to control the high-pass reference. | |
int | lis2dh12_poweron (const lis2dh12_t *dev) |
Power on the given device and resets resolution and sampling rate to default values in the device descriptor parameters. | |
int | lis2dh12_poweroff (const lis2dh12_t *dev) |
Power off the given device. | |
const saul_driver_t | lis2dh12_saul_driver |
Export the SAUL interface for this driver. | |
const saul_driver_t | lis2dh12_saul_temp_driver |