Interface definition for the STM LIS2DH12 accelerometer. More...

Detailed Description

Interface definition for the STM LIS2DH12 accelerometer.

Hauke Petersen

Definition in file lis2dh12.h.

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

Go to the source code of this file.

Data Structures

struct  lis2dh12_params_t
 LIS2DH12 configuration parameters. More...
struct  lis2dh12_t
 LIS2DH12 device descriptor. More...
struct  lis2dh12_int_params_t
 Parameter for interrupt configuration. More...


#define LIS2DH12_ADDR_DEFAULT   (0x19)
 Default I2C slave address for LIS2DH12 devices.
#define LIS2DH12_INT_SRC_XL   (0x01)
 Status of INT_SRC register. More...
#define LIS2DH12_INT_SRC_XH   (0x02)
 X high event has occurred.
#define LIS2DH12_INT_SRC_YL   (0x04)
 Y low event has occurred.
#define LIS2DH12_INT_SRC_YH   (0x08)
 Y high event has occurred.
#define LIS2DH12_INT_SRC_ZL   (0x10)
 Z low event has occurred.
#define LIS2DH12_INT_SRC_ZH   (0x20)
 Z high event has occurred.
#define LIS2DH12_INT_SRC_IA   (0x40)
 1 if interrupt occurred
#define LIS2DH12_STATUS_XDA   (0x01)
 Status of INT_SRC register. More...
#define LIS2DH12_STATUS_YDA   (0x02)
 Y-axis new data available.
#define LIS2DH12_STATUS_ZDA   (0x04)
 Z-axis new data available.
#define LIS2DH12_STATUS_ZYXDA   (0x08)
 on X-, Y-, Z-axis new data available
#define LIS2DH12_STATUS_XOR   (0x10)
 X-axis data overrun.
#define LIS2DH12_STATUS_YOR   (0x20)
 Y-axis data overrun.
#define LIS2DH12_STATUS_ZOR   (0x40)
 Y-axis data overrun.
#define LIS2DH12_STATUS_ZYXOR   (0x80)
 on X-, Y-, Z-axis data overrun


enum  lis2dh12_scale_t { LIS2DH12_SCALE_2G = 0x00, LIS2DH12_SCALE_4G = 0x10, LIS2DH12_SCALE_8G = 0x20, LIS2DH12_SCALE_16G = 0x30 }
 Available scale values. More...
enum  lis2dh12_rate_t {
  LIS2DH12_RATE_1HZ = 0x17, LIS2DH12_RATE_10HZ = 0x27, LIS2DH12_RATE_25HZ = 0x37, LIS2DH12_RATE_50HZ = 0x47,
  LIS2DH12_RATE_100HZ = 0x57, LIS2DH12_RATE_200HZ = 0x67, LIS2DH12_RATE_400HZ = 0x77
 Available sampling rates. More...
enum  {
  LIS2DH12_OK = 0, LIS2DH12_NOBUS = -1, LIS2DH12_NODEV = -2, LIS2DH12_NOINT = -3,
  LIS2DH12_NODATA = -4
 Status and error return codes. More...
enum  { LIS2DH12_INT1 = 1, LIS2DH12_INT2 = 2 }
enum  {
  LIS2DH12_INT_CFG_XLIE = 0x01, LIS2DH12_INT_CFG_XHIE = 0x02, LIS2DH12_INT_CFG_YLIE = 0x04, LIS2DH12_INT_CFG_YHIE = 0x08,
  LIS2DH12_INT_CFG_ZLIE = 0x10, LIS2DH12_INT_CFG_ZHIE = 0x20, LIS2DH12_INT_CFG_6D = 0x40, LIS2DH12_INT_CFG_AOI = 0x80
 Interrupt config register values. More...
enum  {
  LIS2DH12_INT_TYPE_I1_OVERRUN = 0x02, LIS2DH12_INT_TYPE_I1_WTM = 0x04, LIS2DH12_INT_TYPE_I1_ZYXDA = 0x10, LIS2DH12_INT_TYPE_I1_IA2 = 0x20,
  LIS2DH12_INT_TYPE_I2_BOOT = 0x10, LIS2DH12_INT_TYPE_I2_IA2 = 0x20, LIS2DH12_INT_TYPE_I2_IA1 = 0x40, LIS2DH12_INT_TYPE_I2_CLICK = 0x80
 Interrupt type values. More...


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. More...
int lis2dh12_read_int_src (const lis2dh12_t *dev, uint8_t *data, uint8_t int_line)
 Read an interrupt event on LIS2DH12 sensor device. More...
int lis2dh12_init (lis2dh12_t *dev, const lis2dh12_params_t *params)
 Initialize the given LIS2DH12 sensor device. More...
int lis2dh12_read (const lis2dh12_t *dev, int16_t *data)
 Read acceleration data from the given device. More...
int lis2dh12_poweron (const lis2dh12_t *dev)
 Power on the given device. More...
int lis2dh12_poweroff (const lis2dh12_t *dev)
 Power off the given device. More...


const saul_driver_t lis2dh12_saul_driver
 Export the SAUL interface for this driver.