STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
Adafruit_LIS3DH.h
Go to the documentation of this file.
1/*!
2 * @file Adafruit_LIS3DH.h
3 *
4 * This is a library for the Adafruit LIS3DH Accel breakout board
5 *
6 * Designed specifically to work with the Adafruit LIS3DH Triple-Axis
7 *Accelerometer
8 * (+-2g/4g/8g/16g)
9 *
10 * Pick one up today in the adafruit shop!
11 * ------> https://www.adafruit.com/product/2809
12 *
13 * This sensor communicates over I2C or SPI (our library code supports
14 *both) so you can share it with a bunch of other sensors on the same I2C bus.
15 * There's an address selection pin so you can have two accelerometers share an
16 *I2C bus.
17 *
18 * Adafruit invests time and resources providing this open source code,
19 * please support Adafruit andopen-source hardware by purchasing products
20 * from Adafruit!
21 *
22 * K. Townsend / Limor Fried (Ladyada) - (Adafruit Industries).
23 *
24 * BSD license, all text above must be included in any redistribution
25 */
26
27#ifndef ADAFRUIT_LIS3DH_H
28#define ADAFRUIT_LIS3DH_H
29
30#include "Arduino.h"
31
32#include <SPI.h>
33#include <Wire.h>
34
35#include <Adafruit_BusIO_Register.h>
36#include <Adafruit_I2CDevice.h>
37#include <Adafruit_SPIDevice.h>
38#include <Adafruit_Sensor.h>
39
40/** I2C ADDRESS/BITS **/
41#define LIS3DH_DEFAULT_ADDRESS (0x18) // if SDO/SA0 is 3V, its 0x19
42
43/*!
44 * STATUS_REG_AUX register
45 * 321OR 1, 2 and 3 axis data overrun. Default value: 0
46 * (0: no overrun has occurred; 1: a new set of data has overwritten
47 * the previous ones) 3OR 3 axis data overrun. Default value: 0 (0: no
48 * overrun has occurred; 1: a new data for the 3-axis has overwritten the
49 * previous one) 2OR 2 axis data overrun. Default value: 0 (0: no overrun has
50 * occurred; 1: a new data for the 4-axis has overwritten the previous one) 1OR
51 * 1 axis data overrun. Default value: 0 (0: no overrun has occurred; 1: a new
52 * data for the 1-axis has overwritten the previous one) 321DA 1, 2 and 3 axis
53 * new data available. Default value: 0 (0: a new set of data is not yet
54 * available; 1: a new set of data is available) 3DA: 3 axis new data
55 * available. Default value: 0 (0: a new data for the 3-axis is not yet
56 * available; 1: a new data for the 3-axis is available) 2DA: 2 axis new data
57 * available. Default value: 0 (0: a new data for the 2-axis is not yet
58 * available; 1: a new data for the 2-axis is available) 1DA 1 axis new data
59 * available. Default value: 0 (0: a new data for the 1-axis is not yet
60 * available; 1: a new data for the 1-axis is available)
61 */
62#define LIS3DH_REG_STATUS1 0x07
63#define LIS3DH_REG_OUTADC1_L 0x08 /**< 1-axis acceleration data. Low value */
64#define LIS3DH_REG_OUTADC1_H 0x09 /**< 1-axis acceleration data. High value */
65#define LIS3DH_REG_OUTADC2_L 0x0A /**< 2-axis acceleration data. Low value */
66#define LIS3DH_REG_OUTADC2_H 0x0B /**< 2-axis acceleration data. High value */
67#define LIS3DH_REG_OUTADC3_L 0x0C /**< 3-axis acceleration data. Low value */
68#define LIS3DH_REG_OUTADC3_H 0x0D /**< 3-axis acceleration data. High value */
69#define LIS3DH_REG_INTCOUNT \
70 0x0E /**< INT_COUNTER register [IC7, IC6, IC5, IC4, IC3, IC2, IC1, IC0] */
71#define LIS3DH_REG_WHOAMI \
72 0x0F /**< Device identification register. [0, 0, 1, 1, 0, 0, 1, 1] */
73/*!
74 * TEMP_CFG_REG
75 * Temperature configuration register.
76 * ADC_PD ADC enable. Default value: 0
77 * (0: ADC disabled; 1: ADC enabled)
78 * TEMP_EN Temperature sensor (T) enable. Default value: 0
79 * (0: T disabled; 1: T enabled)
80 */
81#define LIS3DH_REG_TEMPCFG 0x1F
82/*!
83 * CTRL_REG1
84 * [ODR3, ODR2, ODR1, ODR0, LPen, Zen, Yen, Xen]
85 * ODR3-0 Data rate selection. Default value: 00
86 * (0000:50 Hz; Others: Refer to Datasheet Table 26, “Data rate
87 * configuration”) LPen Low power mode enable. Default value: 0 (0: normal
88 * mode, 1: low power mode) Zen Z axis enable. Default value: 1 (0: Z axis
89 * disabled; 1: Z axis enabled) Yen Y axis enable. Default value: 1 (0: Y
90 * axis disabled; 1: Y axis enabled) Xen X axis enable. Default value: 1 (0:
91 * X axis disabled; 1: X axis enabled)
92 */
93#define LIS3DH_REG_CTRL1 0x20
94/*!
95 * CTRL_REG2
96 * [HPM1, HPM0, HPCF2, HPCF1, FDS, HPCLICK, HPIS2, HPIS1]
97 * HPM1-0 High pass filter mode selection. Default value: 00
98 * Refer to Table 29, "High pass filter mode configuration"
99 * HPCF2-1 High pass filter cut off frequency selection
100 * FDS Filtered data selection. Default value: 0
101 * (0: internal filter bypassed; 1: data
102 *from internal filter sent to output register and FIFO) HPCLICK High pass
103 *filter enabled for CLICK function. (0: filter bypassed; 1: filter enabled)
104 *HPIS2 X axis enable. Default value: 1 (0: X axis disabled; 1: X axis
105 *enabled) HPIS1 High pass filter enabled for AOI function on interrupt 1, (0:
106 *filter bypassed; 1: filter enabled)
107 */
108#define LIS3DH_REG_CTRL2 0x21
109/*!
110 * CTRL_REG3
111 * [I1_CLICK, I1_AOI1, I1_AOI2, I1_DRDY1, I1_DRDY2, I1_WTM, I1_OVERRUN, --]
112 * I1_CLICK CLICK interrupt on INT1. Default value 0.
113 * (0: Disable; 1: Enable)
114 * I1_AOI1 AOI1 interrupt on INT1. Default value 0.
115 * (0: Disable; 1: Enable)
116 * I1_AOI2 AOI2 interrupt on INT1. Default value 0.
117 * (0: Disable; 1: Enable)
118 * I1_DRDY1 DRDY1 interrupt on INT1. Default value 0.
119 * (0: Disable; 1: Enable)
120 * I1_DRDY2 DRDY2 interrupt on INT1. Default value 0.
121 * (0: Disable; 1: Enable)
122 * I1_WTM FIFO Watermark interrupt on INT1. Default value 0.
123 * (0: Disable; 1: Enable)
124 * I1_OVERRUN FIFO Overrun interrupt on INT1. Default value 0.
125 * (0: Disable; 1: Enable)
126 */
127#define LIS3DH_REG_CTRL3 0x22
128/*!
129 * CTRL_REG4
130 * [BDU, BLE, FS1, FS0, HR, ST1, ST0, SIM]
131 * BDU Block data update. Default value: 0
132 * (0: continuos update; 1: output registers not updated until MSB
133 * and LSB reading) BLE Big/little endian data selection. Default value 0.
134 * (0: Data LSB @ lower address; 1: Data MSB @ lower address)
135 * FS1-FS0 Full scale selection. default value: 00
136 * (00: +/- 2G; 01: +/- 4G; 10: +/- 8G; 11: +/- 16G)
137 * HR High resolution output mode: Default value: 0
138 * (0: High resolution disable; 1: High resolution Enable)
139 * ST1-ST0 Self test enable. Default value: 00
140 * (00: Self test disabled; Other: See Table 34)
141 * SIM SPI serial interface mode selection. Default value: 0
142 * (0: 4-wire interface; 1: 3-wire interface).
143 */
144#define LIS3DH_REG_CTRL4 0x23
145/*!
146 * CTRL_REG5
147 * [BOOT, FIFO_EN, --, --, LIR_INT1, D4D_INT1, 0, 0]
148 * BOOT Reboot memory content. Default value: 0
149 * (0: normal mode; 1: reboot memory content)
150 * FIFO_EN FIFO enable. Default value: 0
151 * (0: FIFO disable; 1: FIFO Enable)
152 * LIR_INT1 Latch interrupt request on INT1_SRC register, with INT1_SRC
153 * register cleared by reading INT1_SRC itself. Default value: 0. (0: interrupt
154 * request not latched; 1: interrupt request latched) D4D_INT1 4D enable: 4D
155 * detection is enabled on INT1 when 6D bit on INT1_CFG is set to 1.
156 */
157#define LIS3DH_REG_CTRL5 0x24
158
159/*!
160 * CTRL_REG6
161 * [I2_CLICKen, I2_INT1, 0, BOOT_I1, 0, --, H_L, -]
162 */
163#define LIS3DH_REG_CTRL6 0x25
164#define LIS3DH_REG_REFERENCE 0x26 /**< REFERENCE/DATACAPTURE **/
165/*!
166 * STATUS_REG
167 * [ZYXOR, ZOR, YOR, XOR, ZYXDA, ZDA, YDA, XDA]
168 * ZYXOR X, Y and Z axis data overrun. Default value: 0
169 * (0: no overrun has occurred; 1: a new set of data has overwritten
170 * the previous ones) ZOR Z axis data overrun. Default value: 0 (0: no
171 * overrun has occurred; 1: a new data for the Z-axis has overwritten the
172 * previous one) YOR Y axis data overrun. Default value: 0 (0: no overrun
173 * has occurred; 1: a new data for the Y-axis has overwritten the previous one)
174 * XOR X axis data overrun. Default value: 0
175 * (0: no overrun has occurred; 1: a new data for the X-axis has
176 * overwritten the previous one) ZYXDA X, Y and Z axis new data available.
177 * Default value: 0 (0: a new set of data is not yet available; 1: a new set of
178 * data is available) ZDA Z axis new data available. Default value: 0 (0: a
179 * new data for the Z-axis is not yet available; 1: a new data for the Z-axis is
180 * available) YDA Y axis new data available. Default value: 0 (0: a new
181 * data for the Y-axis is not yet available; 1: a new data for the Y-axis is
182 * available)
183 */
184#define LIS3DH_REG_STATUS2 0x27
185#define LIS3DH_REG_OUT_X_L 0x28 /**< X-axis acceleration data. Low value */
186#define LIS3DH_REG_OUT_X_H 0x29 /**< X-axis acceleration data. High value */
187#define LIS3DH_REG_OUT_Y_L 0x2A /**< Y-axis acceleration data. Low value */
188#define LIS3DH_REG_OUT_Y_H 0x2B /**< Y-axis acceleration data. High value */
189#define LIS3DH_REG_OUT_Z_L 0x2C /**< Z-axis acceleration data. Low value */
190#define LIS3DH_REG_OUT_Z_H 0x2D /**< Z-axis acceleration data. High value */
191/*!
192 * FIFO_CTRL_REG
193 * [FM1, FM0, TR, FTH4, FTH3, FTH2, FTH1, FTH0]
194 * FM1-FM0 FIFO mode selection. Default value: 00 (see Table 44)
195 * TR Trigger selection. Default value: 0
196 * 0: Trigger event liked to trigger signal on INT1
197 * 1: Trigger event liked to trigger signal on INT2
198 * FTH4:0 Default value: 0
199 */
200#define LIS3DH_REG_FIFOCTRL 0x2E
201#define LIS3DH_REG_FIFOSRC \
202 0x2F /**< FIFO_SRC_REG [WTM, OVRN_FIFO, EMPTY, FSS4, FSS3, FSS2, FSS1, FSS0] \
203 */
204/*!
205 * INT1_CFG
206 * [AOI, 6D, ZHIE/ZUPE, ZLIE/ZDOWNE, YHIE/YUPE, XHIE/XUPE, XLIE/XDOWNE]
207 * AOI And/Or combination of Interrupt events. Default value: 0. Refer
208 * to Datasheet Table 48, "Interrupt mode" 6D 6 direction detection
209 * function enabled. Default value: 0. Refer to Datasheet Table 48, "Interrupt
210 * mode" ZHIE/ZUPE Enable interrupt generation on Z high event or on Direction
211 * recognition. Default value: 0. (0: disable interrupt request; 1: enable
212 * interrupt request) ZLIE/ZDOWNE Enable interrupt generation on Z low event or
213 * on Direction recognition. Default value: 0. YHIE/YUPE Enable interrupt
214 * generation on Y high event or on Direction recognition. Default value: 0. (0:
215 * disable interrupt request; 1: enable interrupt request.) YLIE/YDOWNE Enable
216 * interrupt generation on Y low event or on Direction recognition. Default
217 * value: 0. (0: disable interrupt request; 1: enable interrupt request.)
218 * XHIE/XUPE Enable interrupt generation on X high event or on Direction
219 * recognition. Default value: 0. (0: disable interrupt request; 1: enable
220 * interrupt request.) XLIE/XDOWNE Enable interrupt generation on X low event or
221 * on Direction recognition. Default value: 0. (0: disable interrupt request; 1:
222 * enable interrupt request.)
223 */
224#define LIS3DH_REG_INT1CFG 0x30
225/*!
226 * INT1_SRC
227 * [0, IA, ZH, ZL, YH, YL, XH, XL]
228 * IA Interrupt active. Default value: 0
229 * (0: no interrupt has been generated; 1: one or more interrupts have
230 * been generated) ZH Z high. Default value: 0 (0: no interrupt, 1: Z High
231 * event has occurred) ZL Z low. Default value: 0 (0: no interrupt; 1: Z Low
232 * event has occurred) YH Y high. Default value: 0 (0: no interrupt, 1: Y High
233 * event has occurred) YL Y low. Default value: 0 (0: no interrupt, 1: Y Low
234 * event has occurred) XH X high. Default value: 0 (0: no interrupt, 1: X High
235 * event has occurred) XL X low. Default value: 0 (0: no interrupt, 1: X Low
236 * event has occurred)
237 *
238 * Interrupt 1 source register. Read only register.
239 * Reading at this address clears INT1_SRC IA bit (and the interrupt signal
240 * on INT 1 pin) and allows the refreshment of data in the INT1_SRC register if
241 * the latched option was chosen.
242 */
243#define LIS3DH_REG_INT1SRC 0x31
244#define LIS3DH_REG_INT1THS \
245 0x32 /**< INT1_THS register [0, THS6, THS5, THS4, THS3, THS1, THS0] */
246#define LIS3DH_REG_INT1DUR \
247 0x33 /**< INT1_DURATION [0, D6, D5, D4, D3, D2, D1, D0] */
248/*!
249 * CLICK_CFG
250 * [--, --, ZD, ZS, YD, YS, XD, XS]
251 * ZD Enable interrupt double CLICK-CLICK on Z axis. Default value: 0
252 * (0: disable interrupt request;
253 * 1: enable interrupt request on measured accel. value higher than
254 * preset threshold) ZS Enable interrupt single CLICK-CLICK on Z axis. Default
255 * value: 0 (0: disable interrupt request; 1: enable interrupt request on
256 * measured accel. value higher than preset threshold) YD Enable interrupt
257 * double CLICK-CLICK on Y axis. Default value: 0 (0: disable interrupt request;
258 * 1: enable interrupt request on measured accel. value higher than
259 * preset threshold) YS Enable interrupt single CLICK-CLICK on Y axis. Default
260 * value: 0 (0: disable interrupt request; 1: enable interrupt request on
261 * measured accel. value higher than preset threshold) XD Enable interrupt
262 * double CLICK-CLICK on X axis. Default value: 0 (0: disable interrupt request;
263 * 1: enable interrupt request on measured accel. value higher than preset
264 * threshold) XS Enable interrupt single CLICK-CLICK on X axis. Default value:
265 * 0 (0: disable interrupt request; 1: enable interrupt request on measured
266 * accel. value higher than preset threshold)
267 */
268#define LIS3DH_REG_CLICKCFG 0x38
269/*!
270 * CLICK_SRC
271 * [-, IA, DCLICK, SCLICK, Sign, Z, Y, X]
272 * IA Interrupt active. Default value: 0
273 * (0: no interrupt has been generated; 1: one or more interrupts have
274 * been generated) DCLICK Double CLICK-CLICK enable. Default value: 0 (0:double
275 * CLICK-CLICK detection disable, 1: double CLICK-CLICK detection enable) SCLICK
276 * Single CLICK-CLICK enable. Default value: 0 (0:Single CLICK-CLICK detection
277 * disable, 1: single CLICK-CLICK detection enable) Sign CLICK-CLICK Sign.
278 * (0: positive detection, 1: negative detection)
279 * Z Z CLICK-CLICK detection. Default value: 0
280 * (0: no interrupt, 1: Z High event has occurred)
281 * Y Y CLICK-CLICK detection. Default value: 0
282 * (0: no interrupt, 1: Y High event has occurred)
283 * X X CLICK-CLICK detection. Default value: 0
284 * (0: no interrupt, 1: X High event has occurred)
285 */
286#define LIS3DH_REG_CLICKSRC 0x39
287/*!
288 * CLICK_THS
289 * [-, Ths6, Ths5, Ths4, Ths3, Ths2, Ths1, Ths0]
290 * Ths6-Ths0 CLICK-CLICK threshold. Default value: 000 0000
291 */
292#define LIS3DH_REG_CLICKTHS 0x3A
293/*!
294 * TIME_LIMIT
295 * [-, TLI6, TLI5, TLI4, TLI3, TLI2, TLI1, TLI0]
296 * TLI7-TLI0 CLICK-CLICK Time Limit. Default value: 000 0000
297 */
298#define LIS3DH_REG_TIMELIMIT 0x3B
299/*!
300 * TIME_LATANCY
301 * [-, TLA6, TLIA5, TLA4, TLA3, TLA2, TLA1, TLA0]
302 * TLA7-TLA0 CLICK-CLICK Time Latency. Default value: 000 0000
303 */
304#define LIS3DH_REG_TIMELATENCY 0x3C
305/*!
306 * TIME_WINDOW
307 * [TW7, TW6, TW5, TW4, TW3, TW2, TW1, TW0]
308 * TW7-TW0 CLICK-CLICK Time window
309 */
310#define LIS3DH_REG_TIMEWINDOW 0x3D
311
312#define LIS3DH_LSB16_TO_KILO_LSB10 \
313 64000 ///< Scalar to convert from 16-bit lsb to 10-bit and divide by 1k to
314 ///< convert from milli-gs to gs
315#define LIS3DH_LSB16_TO_KILO_LSB12 \
316 16000 ///< Scalar to convert from 16-bit lsb to 12-bit and divide by 1k to
317 ///< convert from milli-gs to gs
318#define LIS3DH_LSB16_TO_KILO_LSB8 \
319 256000 ///< Scalar to convert from 16-bit lsb to 8-bit and divide by 1k to
320 ///< convert from milli-gs to gs
321
322#define LIS3DH_DEFAULT_SPIFREQ 500000 ///< SPI frequency for LIS3DH
323
324/** A structure to represent scales **/
325typedef enum {
326 LIS3DH_RANGE_16_G = 0b11, // +/- 16g
327 LIS3DH_RANGE_8_G = 0b10, // +/- 8g
328 LIS3DH_RANGE_4_G = 0b01, // +/- 4g
329 LIS3DH_RANGE_2_G = 0b00 // +/- 2g (default value)
331
332/** A structure to represent axes **/
333typedef enum {
338
339/** Operational / performance modes **/
345
346/*!
347 * @brief Data rate selection
348 * Used with register 0x2A (LIS3DH_REG_CTRL_REG1) to set bandwidth
349 */
363
364/*!
365 * @brief Class that stores state and functions for interacting with
366 * Adafruit_LIS3DH
367 */
368class Adafruit_LIS3DH : public Adafruit_Sensor {
369public:
370 Adafruit_LIS3DH(TwoWire *Wi = &Wire);
371 Adafruit_LIS3DH(int8_t cspin, SPIClass *theSPI = &SPI,
372 uint32_t frequency = LIS3DH_DEFAULT_SPIFREQ);
373 Adafruit_LIS3DH(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin,
374 uint32_t frequency = LIS3DH_DEFAULT_SPIFREQ);
375
376 bool begin(uint8_t addr = LIS3DH_DEFAULT_ADDRESS, uint8_t nWAI = 0x33);
377
378 uint8_t getDeviceID(void);
379 bool haveNewData(void);
380 bool enableDRDY(bool enable_drdy = true, uint8_t int_pin = 1);
381
382 void read(void);
383 int16_t readADC(uint8_t a);
384
387
388 void setRange(lis3dh_range_t range);
390
391 void setDataRate(lis3dh_dataRate_t dataRate);
393
394 bool getEvent(sensors_event_t *event);
395 void getSensor(sensor_t *sensor);
396
397 void setClick(uint8_t c, uint8_t clickthresh, uint8_t timelimit = 10,
398 uint8_t timelatency = 20, uint8_t timewindow = 255);
399 uint8_t getClick(void);
400
401 uint8_t readAndClearInterrupt(void);
402
403 void configureHighGInterrupt(uint8_t ths, uint8_t dur);
404
405 int16_t x; /**< x axis value */
406 int16_t y; /**< y axis value */
407 int16_t z; /**< z axis value */
408
409 float x_g; /**< x_g axis value (calculated by selected range) */
410 float y_g; /**< y_g axis value (calculated by selected range) */
411 float z_g; /**< z_g axis value (calculated by selected range) */
412
413private:
414 TwoWire *I2Cinterface;
415 SPIClass *SPIinterface;
416
417 Adafruit_I2CDevice *i2c_dev = NULL; ///< Pointer to I2C bus interface
418 Adafruit_SPIDevice *spi_dev = NULL; ///< Pointer to SPI bus interface
419
420 uint8_t _wai;
421
422 int8_t _cs, _mosi, _miso, _sck;
423
424 int8_t _i2caddr;
425
426 int32_t _sensorID;
428};
429
430#endif
lis3dh_range_t
A structure to represent scales.
@ LIS3DH_RANGE_16_G
@ LIS3DH_RANGE_8_G
@ LIS3DH_RANGE_2_G
@ LIS3DH_RANGE_4_G
lis3dh_dataRate_t
Data rate selection Used with register 0x2A (LIS3DH_REG_CTRL_REG1) to set bandwidth.
@ LIS3DH_DATARATE_LOWPOWER_5KHZ
@ LIS3DH_DATARATE_10_HZ
@ LIS3DH_DATARATE_25_HZ
@ LIS3DH_DATARATE_LOWPOWER_1K6HZ
@ LIS3DH_DATARATE_50_HZ
@ LIS3DH_DATARATE_400_HZ
@ LIS3DH_DATARATE_1_HZ
@ LIS3DH_DATARATE_200_HZ
@ LIS3DH_DATARATE_100_HZ
@ LIS3DH_DATARATE_POWERDOWN
lis3dh_axis_t
A structure to represent axes.
@ LIS3DH_AXIS_Z
@ LIS3DH_AXIS_Y
@ LIS3DH_AXIS_X
#define LIS3DH_DEFAULT_SPIFREQ
SPI frequency for LIS3DH.
#define LIS3DH_DEFAULT_ADDRESS
I2C ADDRESS/BITS.
lis3dh_mode_t
Operational / performance modes.
@ LIS3DH_MODE_HIGH_RESOLUTION
@ LIS3DH_MODE_LOW_POWER
@ LIS3DH_MODE_NORMAL
float z_g
z_g axis value (calculated by selected range)
lis3dh_mode_t getPerformanceMode(void)
Gets the performance mode for the LIS3DH.
SPIClass * SPIinterface
Adafruit_LIS3DH(TwoWire *Wi=&Wire)
Instantiates a new LIS3DH class in I2C.
lis3dh_dataRate_t getDataRate(void)
Gets the data rate for the LIS3DH (controls power consumption).
bool getEvent(sensors_event_t *event)
Gets the most recent sensor event.
void getSensor(sensor_t *sensor)
Gets the sensor_t data.
int16_t z
z axis value
void setPerformanceMode(lis3dh_mode_t mode)
Sets the performance mode for the LIS3DH.
Adafruit_SPIDevice * spi_dev
Pointer to SPI bus interface.
void read(void)
Reads x y z values at once.
Adafruit_I2CDevice * i2c_dev
Pointer to I2C bus interface.
int16_t x
x axis value
float x_g
x_g axis value (calculated by selected range)
int16_t y
y axis value
lis3dh_range_t getRange(void)
Gets the g range for the accelerometer.
uint8_t readAndClearInterrupt(void)
Get uint8_t for INT1 source and clear interrupt.
void configureHighGInterrupt(uint8_t ths, uint8_t dur)
Configure INT1 for high-G threshold interrupt with high-pass filter.
uint8_t getDeviceID(void)
Get Device ID from LIS3DH_REG_WHOAMI.
int16_t readADC(uint8_t a)
Read the auxilary ADC.
void setRange(lis3dh_range_t range)
Sets the g range for the accelerometer.
bool haveNewData(void)
Check to see if new data available.
bool enableDRDY(bool enable_drdy=true, uint8_t int_pin=1)
Enable or disable the Data Ready interupt.
void setDataRate(lis3dh_dataRate_t dataRate)
Sets the data rate for the LIS3DH (controls power consumption).
void setClick(uint8_t c, uint8_t clickthresh, uint8_t timelimit=10, uint8_t timelatency=20, uint8_t timewindow=255)
Set INT to output for single or double click.
uint8_t getClick(void)
Get uint8_t for single or double click.
float y_g
y_g axis value (calculated by selected range)
#define NULL
Definition usbd_def.h:44
*brief append another JSON pointer at the end of this JSON pointer *sa ptr reference_tokens begin()
*brief create JSON pointer *sa reference_tokens const string_t & a
Definition json.hpp:13877