32 #define LIS2DS12_DEFAULT_I2C_BUS 0 33 #define LIS2DS12_DEFAULT_SPI_BUS 0 34 #define LIS2DS12_DEFAULT_I2C_ADDR 0x1e 37 #define LIS2DS12_CHIPID 0x43 50 LIS2DS12_REG_SENSORHUB1_REG = 0x06,
51 LIS2DS12_REG_SENSORHUB2_REG = 0x07,
52 LIS2DS12_REG_SENSORHUB3_REG = 0x08,
53 LIS2DS12_REG_SENSORHUB4_REG = 0x09,
54 LIS2DS12_REG_SENSORHUB5_REG = 0x0a,
55 LIS2DS12_REG_SENSORHUB6_REG = 0x0b,
57 LIS2DS12_REG_MODULE_8BIT = 0x0c,
61 LIS2DS12_REG_WHO_AM_I = 0x0f,
65 LIS2DS12_REG_CTRL1 = 0x20,
66 LIS2DS12_REG_CTRL2 = 0x21,
67 LIS2DS12_REG_CTRL3 = 0x22,
68 LIS2DS12_REG_CTRL4 = 0x23,
69 LIS2DS12_REG_CTRL5 = 0x24,
71 LIS2DS12_REG_FIFO_CTRL = 0x25,
73 LIS2DS12_REG_OUT_T = 0x26,
75 LIS2DS12_REG_STATUS = 0x27,
77 LIS2DS12_REG_OUT_X_L = 0x28,
78 LIS2DS12_REG_OUT_X_H = 0x29,
79 LIS2DS12_REG_OUT_Y_L = 0x2a,
80 LIS2DS12_REG_OUT_Y_H = 0x2b,
81 LIS2DS12_REG_OUT_Z_L = 0x2c,
82 LIS2DS12_REG_OUT_Z_H = 0x2d,
84 LIS2DS12_REG_FIFO_THS = 0x2e,
85 LIS2DS12_REG_FIFO_SRC = 0x2f,
86 LIS2DS12_REG_FIFO_SAMPLES = 0x30,
88 LIS2DS12_REG_TAP_6D_THS = 0x31,
89 LIS2DS12_REG_INT_DUR = 0x32,
91 LIS2DS12_REG_WAKE_UP_THS = 0x33,
92 LIS2DS12_REG_WAKE_UP_DUR = 0x34,
94 LIS2DS12_REG_FREE_FALL = 0x35,
96 LIS2DS12_REG_STATUS_DUP = 0x36,
98 LIS2DS12_REG_WAKE_UP_SRC = 0x37,
100 LIS2DS12_REG_TAP_SRC = 0x38,
101 LIS2DS12_REG_6D_SRC = 0x39,
103 LIS2DS12_REG_STEP_COUNTER_MINTHS = 0x3a,
104 LIS2DS12_REG_STEP_COUNTER_L = 0x3b,
105 LIS2DS12_REG_STEP_COUNTER_H = 0x3c,
107 LIS2DS12_REG_FUNC_CK_GATE = 0x3d,
108 LIS2DS12_REG_FUNC_SRC = 0x3e,
109 LIS2DS12_REG_FUNC_CTRL = 0x3f,
116 LIS2DS12_CTRL1_BDU = 0x01,
117 LIS2DS12_CTRL1_HF_ODR = 0x02,
119 LIS2DS12_CTRL1_FS0 = 0x04,
120 LIS2DS12_CTRL1_FS1 = 0x08,
121 _LIS2DS12_CTRL1_FS_MASK = 3,
122 _LIS2DS12_CTRL1_FS_SHIFT = 2,
124 LIS2DS12_CTRL1_ODR0 = 0x10,
125 LIS2DS12_CTRL1_ODR1 = 0x20,
126 LIS2DS12_CTRL1_ODR2 = 0x40,
127 LIS2DS12_CTRL1_ODR3 = 0x80,
128 _LIS2DS12_CTRL1_ODR_MASK = 15,
129 _LIS2DS12_CTRL1_ODR_SHIFT = 4,
130 } LIS2DS12_CTRL1_BITS_T;
147 LIS2DS12_ODR_POWER_DOWN = 0,
151 LIS2DS12_ODR_12_5HZ = 1,
152 LIS2DS12_ODR_25HZ = 2,
153 LIS2DS12_ODR_50HZ = 3,
154 LIS2DS12_ODR_100HZ = 4,
165 LIS2DS12_ODR_200HZ = 5,
166 LIS2DS12_ODR_400HZ = 6,
167 LIS2DS12_ODR_800HZ = 7,
172 LIS2DS12_ODR_1600HZ = (16 + 5),
173 LIS2DS12_ODR_3200HZ = (16 + 6),
174 LIS2DS12_ODR_6400HZ = (16 + 7),
177 LIS2DS12_ODR_LP_1HZ = 8,
178 LIS2DS12_ODR_LP_12_5HZ = 9,
179 LIS2DS12_ODR_LP_25HZ = 10,
180 LIS2DS12_ODR_LP_50HZ = 11,
181 LIS2DS12_ODR_LP_100HZ = 12,
182 LIS2DS12_ODR_LP_200HZ = 13,
183 LIS2DS12_ODR_LP_400HZ = 14,
184 LIS2DS12_ODR_LP_800HZ = 15,
191 LIS2DS12_CTRL2_SIM = 0x01,
192 LIS2DS12_CTRL2_I2C_DISABLE = 0x02,
193 LIS2DS12_CTRL2_IF_ADD_INC = 0x04,
194 LIS2DS12_CTRL2_FDS_SLOPE = 0x08,
195 LIS2DS12_CTRL2_FUNC_CFG_ENABLE = 0x10,
199 LIS2DS12_CTRL2_SOFT_RESET = 0x40,
200 LIS2DS12_CTRL2_BOOT = 0x80,
201 } LIS2DS12_CTRL2_BITS_T;
207 LIS2DS12_CTRL3_PP_OD = 0x01,
208 LIS2DS12_CTRL3_H_LACTIVE = 0x02,
209 LIS2DS12_CTRL3_LIR = 0x04,
210 LIS2DS12_CTRL3_TAP_Z_EN = 0x08,
211 LIS2DS12_CTRL3_TAP_Y_EN = 0x10,
212 LIS2DS12_CTRL3_TAP_X_EN = 0x20,
214 LIS2DS12_CTRL3_ST0 = 0x40,
215 LIS2DS12_CTRL3_ST1 = 0x80,
216 _LIS2DS12_CTRL3_ST_MASK = 3,
217 _LIS2DS12_CTRL3_ST_SHIFT = 6,
218 } LIS2DS12_CTRL3_BITS_T;
224 LIS2DS12_ST_NORMAL = 0,
225 LIS2DS12_ST_POS_SIGN = 1,
226 LIS2DS12_ST_NEG_SIGN = 2
233 LIS2DS12_CTRL4_INT1_DRDY = 0x01,
234 LIS2DS12_CTRL4_INT1_FTH = 0x02,
235 LIS2DS12_CTRL4_INT1_6D = 0x04,
236 LIS2DS12_CTRL4_INT1_TAP = 0x08,
237 LIS2DS12_CTRL4_INT1_FF = 0x10,
238 LIS2DS12_CTRL4_INT1_WU = 0x20,
239 LIS2DS12_CTRL4_INT1_S_TAP = 0x40,
240 LIS2DS12_CTRL4_INT1_MASTER_DRDY = 0x80,
241 } LIS2DS12_CTRL4_BITS_T;
247 LIS2DS12_CTRL5_INT2_DRDY = 0x01,
248 LIS2DS12_CTRL5_INT2_FTH = 0x02,
249 LIS2DS12_CTRL5_INT2_STEP_DET = 0x04,
250 LIS2DS12_CTRL5_INT2_SIG_MOT = 0x08,
251 LIS2DS12_CTRL5_INT2_TILT = 0x10,
252 LIS2DS12_CTRL5_INT2_ON_INT1 = 0x20,
253 LIS2DS12_CTRL5_INT2_BOOT = 0x40,
254 LIS2DS12_CTRL5_INT2_DRDY_PULSED = 0x80,
255 } LIS2DS12_CTRL5_BITS_T;
261 LIS2DS12_FIFO_CTRL_IF_CS_PU_DIS = 0x01,
265 LIS2DS12_FIFO_CTRL_MODULE_TO_FIFO = 0x08,
266 LIS2DS12_FIFO_CTRL_INT2_STEP_COUNT_OV = 0x10,
268 LIS2DS12_FIFO_CTRL_FMODE0 = 0x20,
269 LIS2DS12_FIFO_CTRL_FMODE1 = 0x40,
270 LIS2DS12_FIFO_CTRL_FMODE2 = 0x80,
271 _LIS2DS12_FIFO_CTRL_FMODE_MASK = 7,
272 _LIS2DS12_FIFO_CTRL_FMODE_SHIFT = 5,
273 } LIS2DS12_FIFO_CTRL_BITS_T;
279 LIS2DS12_FMODE_BYPASS = 0,
280 LIS2DS12_FMODE_FIFO = 1,
282 LIS2DS12_FMODE_CONT_TO_FIFO = 3,
283 LIS2DS12_FMODE_BYPASS_TO_CONT = 4,
285 LIS2DS12_FMODE_CONT = 6,
293 LIS2DS12_STATUS_DRDY = 0x01,
294 LIS2DS12_STATUS_FF_IA = 0x02,
295 LIS2DS12_STATUS_6D_IA = 0x04,
296 LIS2DS12_STATUS_SINGLE_TAP = 0x08,
297 LIS2DS12_STATUS_DOUBLE_TAP = 0x10,
298 LIS2DS12_STATUS_SLEEP_STATE = 0x20,
299 LIS2DS12_STATUS_WU_IA = 0x40,
300 LIS2DS12_STATUS_FIFO_THS = 0x80,
301 } LIS2DS12_STATUS_BITS_T;
308 LIS2DS12_FIFO_SRC_DIFF8 = 0x20,
309 LIS2DS12_FIFO_SRC_FIFO_OVR = 0x40,
310 LIS2DS12_FIFO_SRC_FTH = 0x80,
311 } LIS2DS12_FIFO_SRC_BITS_T;
317 LIS2DS12_TAP_6D_THS_TAP_THS0 = 0x01,
318 LIS2DS12_TAP_6D_THS_TAP_THS1 = 0x02,
319 LIS2DS12_TAP_6D_THS_TAP_THS2 = 0x04,
320 LIS2DS12_TAP_6D_THS_TAP_THS3 = 0x08,
321 LIS2DS12_TAP_6D_THS_TAP_THS4 = 0x10,
322 _LIS2DS12_TAP_6D_THS_TAP_THS_MASK = 31,
323 _LIS2DS12_TAP_6D_THS_TAP_THS_SHIFT = 0,
325 LIS2DS12_TAP_6D_THS_6D_THS0 = 0x20,
326 LIS2DS12_TAP_6D_THS_6D_THS1 = 0x40,
327 _LIS2DS12_TAP_6D_THS_6D_THS_MASK = 3,
328 _LIS2DS12_TAP_6D_THS_6D_THS_SHIFT = 5,
330 LIS2DS12_TAP_6D_THS_6D_4D_EN = 0x80,
332 } LIS2DS12_TAP_6D_THS_BITS_T;
338 LIS2DS12_6D_THS_6 = 0,
339 LIS2DS12_6D_THS_11 = 1,
340 LIS2DS12_6D_THS_16 = 2,
341 LIS2DS12_6D_THS_21 = 3,
348 LIS2DS12_INT_DUR_SHOCK0 = 0x01,
349 LIS2DS12_INT_DUR_SHOCK1 = 0x02,
350 _LIS2DS12_INT_DUR_SHOCK_MASK = 3,
351 _LIS2DS12_INT_DUR_SHOCK_SHIFT = 0,
353 LIS2DS12_INT_DUR_QUIET0 = 0x04,
354 LIS2DS12_INT_DUR_QUIET1 = 0x08,
355 _LIS2DS12_INT_DUR_QUIET_MASK = 3,
356 _LIS2DS12_INT_DUR_QUIET_SHIFT = 2,
358 LIS2DS12_INT_DUR_LAT0 = 0x10,
359 LIS2DS12_INT_DUR_LAT1 = 0x20,
360 LIS2DS12_INT_DUR_LAT2 = 0x40,
361 LIS2DS12_INT_DUR_LAT3 = 0x80,
362 _LIS2DS12_INT_DUR_LAT_MASK = 15,
363 _LIS2DS12_INT_DUR_LAT_SHIFT = 4,
365 } LIS2DS12_INT_DUR_BITS_T;
371 LIS2DS12_WAKE_UP_THS_WU_THS0 = 0x01,
372 LIS2DS12_WAKE_UP_THS_WU_THS1 = 0x02,
373 LIS2DS12_WAKE_UP_THS_WU_THS2 = 0x04,
374 LIS2DS12_WAKE_UP_THS_WU_THS3 = 0x08,
375 LIS2DS12_WAKE_UP_THS_WU_THS4 = 0x10,
376 LIS2DS12_WAKE_UP_THS_WU_THS5 = 0x20,
377 _LIS2DS12_WAKE_UP_THS_WU_THS_MASK = 63,
378 _LIS2DS12_WAKE_UP_THS_WU_THS_SHIFT = 0,
380 LIS2DS12_WAKE_UP_THS_SLEEP_ON = 0x40,
381 LIS2DS12_WAKE_UP_THS_SINGLE_DOUBLE_TAP = 0x80,
382 } LIS2DS12_WAKE_UP_THS_BITS_T;
388 LIS2DS12_WAKE_UP_DUR_SLEEP_DUR0 = 0x01,
389 LIS2DS12_WAKE_UP_DUR_SLEEP_DUR1 = 0x02,
390 LIS2DS12_WAKE_UP_DUR_SLEEP_DUR2 = 0x04,
391 LIS2DS12_WAKE_UP_DUR_SLEEP_DUR3 = 0x08,
392 _LIS2DS12_WAKE_UP_DUR_SLEEP_DUR_MASK = 15,
393 _LIS2DS12_WAKE_UP_DUR_SLEEP_DUR_SHIFT = 0,
395 LIS2DS12_WAKE_UP_DUR_INT1_FSS7 = 0x10,
397 LIS2DS12_WAKE_UP_DUR_WU_DUR0 = 0x20,
398 LIS2DS12_WAKE_UP_DUR_WU_DUR1 = 0x40,
399 _LIS2DS12_WAKE_UP_DUR_WU_DUR_MASK = 3,
400 _LIS2DS12_WAKE_UP_DUR_WU_DUR_SHIFT = 5,
402 LIS2DS12_WAKE_UP_DUR_FF_DUR5 = 0x80,
403 } LIS2DS12_WAKE_UP_DUR_BITS_T;
409 LIS2DS12_FREE_FALL_FF_THS0 = 0x01,
410 LIS2DS12_FREE_FALL_FF_THS1 = 0x02,
411 LIS2DS12_FREE_FALL_FF_THS2 = 0x04,
412 _LIS2DS12_FREE_FALL_FF_THS_MASK = 7,
413 _LIS2DS12_FREE_FALL_FF_THS_SHIFT = 0,
415 LIS2DS12_FREE_FALL_FF_DUR0 = 0x08,
416 LIS2DS12_FREE_FALL_FF_DUR1 = 0x10,
417 LIS2DS12_FREE_FALL_FF_DUR2 = 0x20,
418 LIS2DS12_FREE_FALL_FF_DUR3 = 0x40,
419 LIS2DS12_FREE_FALL_FF_DUR4 = 0x80,
420 _LIS2DS12_FREE_FALL_FF_MASK = 31,
421 _LIS2DS12_FREE_FALL_FF_SHIFT = 3,
422 } LIS2DS12_FREE_FALL_BITS_T;
428 LIS2DS12_STATUS_DUP_DRDY = 0x01,
429 LIS2DS12_STATUS_DUP_FF_IA = 0x02,
430 LIS2DS12_STATUS_DUP_6D_IA = 0x04,
431 LIS2DS12_STATUS_DUP_SINGLE_TAP = 0x08,
432 LIS2DS12_STATUS_DUP_DOUBLE_TAP = 0x10,
433 LIS2DS12_STATUS_DUP_SLEEP_STATE = 0x20,
434 LIS2DS12_STATUS_DUP_WU_IA = 0x40,
435 LIS2DS12_STATUS_DUP_OVR = 0x80,
436 } LIS2DS12_STATUS_DUP_BITS_T;
442 LIS2DS12_WAKE_UP_SRC_Z_WU = 0x01,
443 LIS2DS12_WAKE_UP_SRC_Y_WU = 0x02,
444 LIS2DS12_WAKE_UP_SRC_X_WU = 0x04,
446 LIS2DS12_WAKE_UP_SRC_WU_IA = 0x08,
447 LIS2DS12_WAKE_UP_SRC_SLEEP_STATE_IA = 0x10,
448 LIS2DS12_WAKE_UP_SRC_FF_IA = 0x20,
451 } LIS2DS12_WAKE_UP_SRC_BITS_T;
457 LIS2DS12_TAP_SRC_Z_TAP = 0x01,
458 LIS2DS12_TAP_SRC_Y_TAP = 0x02,
459 LIS2DS12_TAP_SRC_X_TAP = 0x04,
460 LIS2DS12_TAP_SRC_TAP_SIGN = 0x08,
461 LIS2DS12_TAP_SRC_DOUBLE_TAP = 0x10,
462 LIS2DS12_TAP_SRC_SINGLE_TAP = 0x20,
463 LIS2DS12_TAP_SRC_TAP_IA = 0x40,
466 } LIS2DS12_TAP_SRC_BITS_T;
472 LIS2DS12_6D_SRC_XL = 0x01,
473 LIS2DS12_6D_SRC_XH = 0x02,
474 LIS2DS12_6D_SRC_YL = 0x04,
475 LIS2DS12_6D_SRC_YH = 0x08,
476 LIS2DS12_6D_SRC_ZL = 0x10,
477 LIS2DS12_6D_SRC_ZH = 0x20,
479 LIS2DS12_6D_IA = 0x40,
482 } LIS2DS12_6D_SRC_BITS_T;
488 LIS2DS12_STEP_COUNTER_MINTHS_SC_MTHS0 = 0x01,
489 LIS2DS12_STEP_COUNTER_MINTHS_SC_MTHS1 = 0x02,
490 LIS2DS12_STEP_COUNTER_MINTHS_SC_MTHS2 = 0x04,
491 LIS2DS12_STEP_COUNTER_MINTHS_SC_MTHS3 = 0x08,
492 LIS2DS12_STEP_COUNTER_MINTHS_SC_MTHS4 = 0x10,
493 LIS2DS12_STEP_COUNTER_MINTHS_SC_MTHS5 = 0x20,
494 _LIS2DS12_STEP_COUNTER_MINTHS_SC_MTHS5_MASK = 63,
495 _LIS2DS12_STEP_COUNTER_MINTHS_SC_MTHS5_SHIFT = 0,
497 LIS2DS12_STEP_COUNTER_MINTHS_PEDO4G = 0x40,
498 LIS2DS12_STEP_COUNTER_MINTHS_RST_NSTEP = 0x80,
499 } LIS2DS12_STEP_COUNTER_MINTHS_BITS_T;
505 LIS2DS12_FUNC_CK_GATE_CK_GATE_FUNC = 0x01,
506 LIS2DS12_FUNC_CK_GATE_STEP_DETECT = 0x02,
507 LIS2DS12_FUNC_CK_GATE_RST_PEDO = 0x04,
508 LIS2DS12_FUNC_CK_GATE_RST_SIGN_MOT = 0x08,
509 LIS2DS12_FUNC_CK_GATE_SIG_MOT_DETECT = 0x10,
511 LIS2DS12_FUNC_CK_GATE_FS_SRC0 = 0x20,
512 LIS2DS12_FUNC_CK_GATE_FS_SRC1 = 0x40,
513 _LIS2DS12_FUNC_CK_GATE_FS_SRC_MASK = 3,
514 _LIS2DS12_FUNC_CK_GATE_FS_SRC_SHIFT = 5,
516 LIS2DS12_FUNC_CK_GATE_TILT_INT = 0x80,
517 } LIS2DS12_FUNC_CK_GATE_BITS_T;
523 LIS2DS12_FS_SRC_NO_SCALE = 0,
524 LIS2DS12_FS_SRC_2G = 1,
525 LIS2DS12_FS_SRC_4G = 2,
532 LIS2DS12_FUNC_SRC_SENSORHUB_END_OP = 0x01,
533 LIS2DS12_FUNC_SRC_MODULE_READY = 0x02,
534 LIS2DS12_FUNC_SRC_RST_TILT = 0x04,
537 } LIS2DS12_FUNC_SRC_BITS_T;
543 LIS2DS12_FUNC_CTRL_STEP_CNT_ON = 0x01,
544 LIS2DS12_FUNC_CTRL_SIGN_MOT_ON = 0x02,
545 LIS2DS12_FUNC_CTRL_MASTER_ON = 0x04,
546 LIS2DS12_FUNC_CTRL_TUD_EN = 0x08,
547 LIS2DS12_FUNC_CTRL_TILT_ON = 0x10,
548 LIS2DS12_FUNC_CTRL_MODULE_ON = 0x20,
551 } LIS2DS12_FUNC_CTRL_BITS_T;
555 LIS2DS12_INTERRUPT_INT1,
556 LIS2DS12_INTERRUPT_INT2
557 } LIS2DS12_INTERRUPT_PINS_T;