Adafruit LIS331 Arduino Driver
Classes | Macros | Typedefs | Enumerations
Adafruit_LIS331.h File Reference
#include "Arduino.h"
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_BusIO_Register.h>
#include <Adafruit_I2CDevice.h>
#include <Adafruit_SPIDevice.h>
#include <Adafruit_Sensor.h>

Go to the source code of this file.

Classes

class  Adafruit_LIS331
 Class that stores state and functions for interacting with Adafruit_LIS331. More...
 

Macros

#define LIS331_DEFAULT_ADDRESS   (0x18)
 
#define LIS331_CHIP_ID   0x32
 The default response to WHO_AM_I for the H3LIS331 and LIS331HH.
 
#define LIS331_REG_WHOAMI   0x0F
 
#define LIS331_REG_CTRL1   0x20
 Power mode, data rate, axis enable.
 
#define LIS331_REG_CTRL2   0x21
 Memory reboot, HPF config.
 
#define LIS331_REG_CTRL3   0x22
 Interrupt config, poarity, pin mode, latching, pin enable.
 
#define LIS331_REG_CTRL4   0x23
 BDU, Endianness, Range, SPI mode.
 
#define LIS331_REG_CTRL5   0x24
 Sleep to wake enable.
 
#define LIS331_REG_HP_FILTER_RESET   0x25
 Dummy register to reset filter.
 
#define LIS331_REG_REFERENCE   0x26
 HPF reference value.
 
#define LIS331_REG_STATUS   0x27
 Data overrun status, Data available status.
 
#define LIS331_REG_OUT_X_L   0x28
 
#define LIS331_REG_OUT_X_H   0x29
 
#define LIS331_REG_OUT_Y_L   0x2A
 
#define LIS331_REG_OUT_Y_H   0x2B
 
#define LIS331_REG_OUT_Z_L   0x2C
 
#define LIS331_REG_OUT_Z_H   0x2D
 
#define LIS331_REG_INT1CFG   0x30
 INT1 config. Enable on hi/low for each axis.
 
#define LIS331_REG_INT1SRC   0x31
 INT1 source info.
 
#define LIS331_REG_INT1THS   0x32
 INT1 acceleration threshold.
 
#define LIS331_REG_INT1DUR   0x33
 INT1 duration threshold.
 
#define LIS331_REG_INT2CFG   0x34
 INT2 config. Enable on hi/low for each axis.
 
#define LIS331_REG_INT2SRC   0x35
 INT2 source info.
 
#define LIS331_REG_INT2THS   0x36
 INT2 acceleration threshold.
 
#define LIS331_REG_INT2DUR   0x37
 INT3 duration threshold.
 

Typedefs

typedef enum hpf_cutoff lis331_hpf_cutoff_t
 

Enumerations

enum  hpf_cutoff { LIS331_HPF_0_02_ODR, LIS331_HPF_0_01_ODR, LIS331_HPF_0_005_ODR, LIS331_HPF_0_0025_ODR }
 
enum  lis331_lpf_cutoff_t { LIS331_LPF_37_HZ, LIS331_LPF_74_HZ, LIS331_LPF_292_HZ, LIS331_LPF_780_HZ }
 
enum  lis331_data_rate_t {
  LIS331_DATARATE_POWERDOWN = 0, LIS331_DATARATE_50_HZ = 0x4, LIS331_DATARATE_100_HZ = 0x5, LIS331_DATARATE_400_HZ = 0x6,
  LIS331_DATARATE_1000_HZ = 0x7, LIS331_DATARATE_LOWPOWER_0_5_HZ = 0x8, LIS331_DATARATE_LOWPOWER_1_HZ = 0xC, LIS331_DATARATE_LOWPOWER_2_HZ = 0x10,
  LIS331_DATARATE_LOWPOWER_5_HZ = 0x14, LIS331_DATARATE_LOWPOWER_10_HZ = 0x18
}
 
enum  lis331_axis_t { LIS331_AXIS_X = 0x0, LIS331_AXIS_Y = 0x1, LIS331_AXIS_Z = 0x2 }
 
enum  lis331_mode_t { LIS331_MODE_SHUTDOWN, LIS331_MODE_NORMAL, LIS331_MODE_LOW_POWER }
 Mode Options.
 

Macro Definition Documentation

◆ LIS331_DEFAULT_ADDRESS

#define LIS331_DEFAULT_ADDRESS   (0x18)

Default I2C ADDRESS. If SDO/SA0 is 3V, its 0x19

◆ LIS331_REG_WHOAMI

#define LIS331_REG_WHOAMI   0x0F

Device identification register. [0, 0, 1, 1, 0, 0, 1, 1]

◆ LIS331_REG_OUT_X_L

#define LIS331_REG_OUT_X_L   0x28

X-axis acceleration data. Low value

◆ LIS331_REG_OUT_X_H

#define LIS331_REG_OUT_X_H   0x29

X-axis acceleration data. High value

◆ LIS331_REG_OUT_Y_L

#define LIS331_REG_OUT_Y_L   0x2A

Y-axis acceleration data. Low value

◆ LIS331_REG_OUT_Y_H

#define LIS331_REG_OUT_Y_H   0x2B

Y-axis acceleration data. High value

◆ LIS331_REG_OUT_Z_L

#define LIS331_REG_OUT_Z_L   0x2C

Z-axis acceleration data. Low value

◆ LIS331_REG_OUT_Z_H

#define LIS331_REG_OUT_Z_H   0x2D

Z-axis acceleration data. High value

Typedef Documentation

◆ lis331_hpf_cutoff_t

The high pass filter cutoff frequency

Enumeration Type Documentation

◆ hpf_cutoff

enum hpf_cutoff

The high pass filter cutoff frequency

Enumerator
LIS331_HPF_0_02_ODR 

ODR/50.

LIS331_HPF_0_01_ODR 

ODR/100.

LIS331_HPF_0_005_ODR 

ODR/200.

LIS331_HPF_0_0025_ODR 

ODR/400.

◆ lis331_lpf_cutoff_t

The low pass filter cutoff frequency

◆ lis331_data_rate_t

Used with register 0x2A (LIS331HH_REG_CTRL_REG1) to set bandwidth

◆ lis331_axis_t

A structure to represent axes