adxl345_regs.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Mesotic SAS
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef ADXL345_REGS_H
20 #define ADXL345_REGS_H
21 
22 #ifdef __cplusplus
23  extern "C" {
24 #endif
25 
30 #define ADXL345_CHIP_ID_REG (0x00)
31 #define ADXL345_THRESH_TAP (0x1D)
32 #define ADXL345_OFFSET_X (0x1E)
33 #define ADXL345_OFFSET_Y (0x1F)
34 #define ADXL345_OFFSET_Z (0x20)
35 #define ADXL345_TAP_DUR (0x21)
36 #define ADXL345_TAP_LAT (0x22)
37 #define ADXL345_TAP_WIN (0x23)
38 #define ADXL345_THRESH_ACT (0x24)
39 #define ADXL345_THRESH_INACT (0x25)
40 #define ADXL345_TIME_INACT (0x26)
41 #define ADXL345_ACT_INACT_CTL (0x27)
42 #define ADXL345_THRESH_FF (0x28)
43 #define ADXL345_TIME_FF (0x29)
44 #define ADXL345_TAP_AXES (0x2A)
45 #define ADXL345_ACT_TAP_STATUS (0x2B)
46 #define ADXL345_BW_RATE (0x2C)
47 #define ADXL345_POWER_CTL (0x2D)
48 #define ADXL345_INT_ENABLE (0x2E)
49 #define ADXL345_INT_MAP (0x2F)
50 #define ADXL345_INT_SOURCE (0x30)
51 #define ADXL345_DATA_FORMAT (0x31)
52 #define ADXL345_DATA_X0 (0x32)
53 #define ADXL345_DATA_X1 (0x33)
54 #define ADXL345_DATA_Y0 (0x34)
55 #define ADXL345_DATA_Y1 (0x35)
56 #define ADXL345_DATA_Z0 (0x36)
57 #define ADXL345_DATA_Z1 (0x37)
58 #define ADXL345_FIFO_CTL (0x38)
59 #define ADXL345_FIFO_STATUS (0x39)
66 #define ADXL345_CHIP_ID (0xE5)
67 
73 #define ADXL345_RES_10_BITS (0x03FF)
74 #define ADXL345_RES_11_BITS (0x07FF)
75 #define ADXL345_RES_12_BITS (0x0FFF)
76 #define ADXL345_RES_13_BITS (0x1FFF)
77 
83 #define ADXL345_INACT_Z_ENABLE (1 << 0)
84 #define ADXL345_INACT_Y_ENABLE (1 << 1)
85 #define ADXL345_INACT_X_ENABLE (1 << 2)
86 #define ADXL345_INACT_ACDC (1 << 3)
87 #define ADXL345_ACT_Z_ENABLE (1 << 4)
88 #define ADXL345_ACT_Y_ENABLE (1 << 5)
89 #define ADXL345_ACT_X_ENABLE (1 << 6)
90 #define ADXL345_ACT_ACDC (1 << 7)
91 
97 #define ADXL345_TAP_Z_ENABLE (1 << 0)
98 #define ADXL345_TAP_Y_ENABLE (1 << 1)
99 #define ADXL345_TAP_X_ENABLE (1 << 2)
100 #define ADXL345_SUPPRESS (1 << 3)
101 #define ADXL345_TAP_ALL_ENABLE (ADXL345_TAP_Z_ENABLE | \
102  ADXL345_TAP_Y_ENABLE | \
103  ADXL345_TAP_X_ENABLE)
104 
110 #define ADXL345_TAP_Z_SRC (1 << 0)
111 #define ADXL345_TAP_Y_SRC (1 << 1)
112 #define ADXL345_TAP_X_SRC (1 << 2)
113 #define ADXL345_ASLEEP (1 << 3)
114 #define ADXL345_ACT_Z_SRC (1 << 4)
115 #define ADXL345_ACT_Y_SRC (1 << 5)
116 #define ADXL345_ACT_X_SRC (1 << 6)
117 
123 #define ADXL345_RATE_MASK (0x0F)
124 #define ADXL345_LOWPOWER (1 << 4)
125 
131 #define ADXL345_WAKEUP_8HZ (0x00)
132 #define ADXL345_WAKEUP_4HZ (0x01)
133 #define ADXL345_WAKEUP_2HZ (0x02)
134 #define ADXL345_WAKEUP_1HZ (0x03)
135 #define ADXL345_SLEEP_BIT (1 << 2)
136 #define ADXL345_MEASURE_BIT (1 << 3)
137 #define ADXL345_AUTOSLEEP_BIT (1 << 4)
138 #define ADXL345_LINK_BIT (1 << 5)
139 
146 #define ADXL345_OVERRUN (1 << 0)
147 #define ADXL345_WATERMARK (1 << 1)
148 #define ADXL345_FREEFALL (1 << 2)
149 #define ADXL345_INACTIVITY (1 << 3)
150 #define ADXL345_ACTIVITY (1 << 4)
151 #define ADXL345_DOUBLE_TAP (1 << 5)
152 #define ADXL345_SINGLE_TAP (1 << 6)
153 #define ADXL345_DATA_READY (1 << 7)
154 
160 #define ADXL345_RANGE_MASK (0x03)
161 #define ADXL345_JUSTIFY (1 << 2)
162 #define ADXL345_FULL_RES (1 << 3)
163 #define ADXL345_INT_INVERT (1 << 5)
164 #define ADXL345_SPI_BIT (1 << 6)
165 #define ADXL345_SELF_TEST (1 << 7)
166 
172 #define ADXL345_SAMPLES_MASK (0x0F)
173 #define ADXL345_FIFO_TRIGGER_POS (4)
174 #define ADXL345_FIFO_TRIGGER (1 << ADXL345_FIFO_TRIGGER_POS)
175 #define ADXL345_FIFO_MODE_POS (6)
176 #define ADXL345_FIFO_MODE_MASK (0xC0)
177 
183 #define ADXL345_FIFO_ENTRIES_MASK (0x3F)
184 #define ADXL345_FIFO_TRIG (1 << 7)
185 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 #endif /* ADXL345_REGS_H */
192