stmpe811_constants.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Inria
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 STMPE811_CONSTANTS_H
20 #define STMPE811_CONSTANTS_H
21 
22 #include "stmpe811.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #define STMPE811_I2C_ADDR_DEFAULT (0x41)
30 #define STMPE811_CHIP_ID_VALUE (0x0811)
36 #define STMPE811_CHIP_ID (0x00)
37 #define STMPE811_ID_VER (0x02)
38 #define STMPE811_SYS_CTRL1 (0x03)
39 #define STMPE811_SYS_CTRL2 (0x04)
40 #define STMPE811_SPI_CFG (0x08)
41 #define STMPE811_INT_CTRL (0x09)
42 #define STMPE811_INT_EN (0x0A)
43 #define STMPE811_INT_STA (0x0B)
44 #define STMPE811_GPIO_EN (0x0C)
45 #define STMPE811_GPIO_INT_STA (0x0D)
46 #define STMPE811_ADC_INT_EN (0x0E)
47 #define STMPE811_ADC_INT_STA (0x0F)
48 #define STMPE811_GPIO_SET_PIN (0x10)
49 #define STMPE811_GPIO_CLR_PIN (0x11)
50 #define STMPE811_MP_STA (0x12)
51 #define STMPE811_GPIO_DIR (0x13)
52 #define STMPE811_GPIO_ED (0x14)
53 #define STMPE811_GPIO_RE (0x15)
54 #define STMPE811_GPIO_FE (0x16)
55 #define STMPE811_GPIO_ALT_FUNCTION (0x17)
56 #define STMPE811_ADC_CTRL1 (0x20)
57 #define STMPE811_ADC_CTRL2 (0x21)
58 #define STMPE811_ADC_CAPT (0x22)
59 #define STMPE811_ADC_DATA_CHO (0x30)
60 #define STMPE811_ADC_DATA_CH1 (0x32)
61 #define STMPE811_ADC_DATA_CH2 (0x34)
62 #define STMPE811_ADC_DATA_CH3 (0x36)
63 #define STMPE811_ADC_DATA_CH4 (0x38)
64 #define STMPE811_ADC_DATA_CH5 (0x3A)
65 #define STMPE811_ADC_DATA_CH6 (0x3C)
66 #define STMPE811_ADC_DATA_CH7 (0x3E)
67 #define STMPE811_TSC_CTRL (0x40)
68 #define STMPE811_TSC_CFG (0x41)
69 #define STMPE811_WDW_TR_X (0x42)
70 #define STMPE811_WDW_TR_Y (0x44)
71 #define STMPE811_WDW_BL_X (0x46)
72 #define STMPE811_WDW_BL_Y (0x48)
73 #define STMPE811_FIFO_TH (0x4A)
74 #define STMPE811_FIFO_CTRL_STA (0x4B)
75 #define STMPE811_FIFO_SIZE (0x4C)
76 #define STMPE811_TSC_DATA_X (0x4D)
77 #define STMPE811_TSC_DATA_Y (0x4F)
78 #define STMPE811_TSC_DATA_Z (0x51)
79 #define STMPE811_TSC_DATA_XYZ (0x52)
80 #define STMPE811_TSC_DATA_INC (0x57)
81 #define STMPE811_TSC_DATA_NON_INC (0xD7)
82 #define STMPE811_TSC_FRACTION_Z (0x56)
83 #define STMPE811_TSC_DATA (0x57)
84 #define STMPE811_TSC_I_DRIVE (0x58)
85 #define STMPE811_TSC_SHIELD (0x59)
86 #define STMPE811_TEMP_CTRL (0x60)
87 #define STMPE811_TEMP_DATA (0x61)
88 #define STMPE811_TEMP_TH (0x62)
95 #define STMPE811_SYS_CTRL1_HIBERNATE (1 << 0)
96 #define STMPE811_SYS_CTRL1_SOFT_RESET (1 << 1)
103 #define STMPE811_SYS_CTRL2_ADC_OFF (1 << 0)
104 #define STMPE811_SYS_CTRL2_TSC_OFF (1 << 1)
105 #define STMPE811_SYS_CTRL2_GPIO_OFF (1 << 2)
106 #define STMPE811_SYS_CTRL2_TS_OFF (1 << 3)
113 #define STMPE811_SPI_CFG_SPI_CLK_MOD0 (1 << 0)
114 #define STMPE811_SPI_CFG_SPI_CLK_MOD1 (1 << 1)
115 #define STMPE811_SPI_CFG_AUTO_INCR (1 << 2)
123 #define STMPE811_INT_CTRL_INT_POLARITY (1 << 2)
124 #define STMPE811_INT_CTRL_INT_TYPE (1 << 1)
125 #define STMPE811_INT_CTRL_GLOBAL_INT (1 << 0)
132 #define STMPE811_INT_EN_TOUCH_DET (1 << 0)
133 #define STMPE811_INT_EN_FIFO_TH (1 << 1)
134 #define STMPE811_INT_EN_FIFO_OFLOW (1 << 2)
135 #define STMPE811_INT_EN_FIFO_FULL (1 << 3)
136 #define STMPE811_INT_EN_FIFO_EMPTY (1 << 4)
137 #define STMPE811_INT_EN_TEMP_SENS (1 << 5)
138 #define STMPE811_INT_EN_ADC (1 << 6)
139 #define STMPE811_INT_EN_GPIO (1 << 7)
146 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_POS (4)
147 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_36 (0b000)
148 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_44 (0b001)
149 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_56 (0b010)
150 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_64 (0b011)
151 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_80 (0b100)
152 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_96 (0b101)
153 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_124 (0b110)
154 #define STMPE811_ADC_CTRL1_MOD_12B (1 << 3)
161 #define STMPE811_ADC_CTRL2_FREQ_1_625MHZ (0b00)
162 #define STMPE811_ADC_CTRL2_FREQ_3_25MHZ (0b01)
163 #define STMPE811_ADC_CTRL2_FREQ_6_5MHZ (0b10)
164 #define STMPE811_ADC_CTRL2_FREQ_6_5_2MHZ (0b11)
171 #define STMPE811_TSC_CTRL_EN (1 << 0)
172 #define STMPE811_TSC_CTRL_OPMOD_POS (1)
173 #define STMPE811_TSC_CTRL_OPMOD_XYZ (0b000)
174 #define STMPE811_TSC_CTRL_OPMOD_XY_ONLY (0b001)
175 #define STMPE811_TSC_CTRL_OPMOD_X_ONLY (0b010)
176 #define STMPE811_TSC_CTRL_OPMOD_Y_ONLY (0b011)
177 #define STMPE811_TSC_CTRL_OPMOD_Z_ONLY (0b100)
178 #define STMPE811_TSC_CTRL_TRACK_POS (4)
179 #define STMPE811_TSC_CTRL_TRACK_NO (0b000)
180 #define STMPE811_TSC_CTRL_TRACK_4 (0b001)
181 #define STMPE811_TSC_CTRL_TRACK_8 (0b010)
182 #define STMPE811_TSC_CTRL_TRACK_16 (0b011)
183 #define STMPE811_TSC_CTRL_TRACK_32 (0b100)
184 #define STMPE811_TSC_CTRL_TRACK_64 (0b101)
185 #define STMPE811_TSC_CTRL_TRACK_92 (0b110)
186 #define STMPE811_TSC_CTRL_TRACK_127 (0b111)
187 #define STMPE811_TSC_CTRL_STA (1 << 7)
194 #define STMPE811_TSC_CFG_AVE_CTRL_POS (6)
195 #define STMPE811_TSC_CFG_AVE_CTRL_1 (0b00)
196 #define STMPE811_TSC_CFG_AVE_CTRL_2 (0b01)
197 #define STMPE811_TSC_CFG_AVE_CTRL_4 (0b10)
198 #define STMPE811_TSC_CFG_AVE_CTRL_8 (0b11)
199 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_POS (3)
200 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_10US (0b000)
201 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_50US (0b001)
202 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_100US (0b010)
203 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_500US (0b011)
204 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_1MS (0b100)
205 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_5MS (0b101)
206 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_10MS (0b110)
207 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_50MS (0b111)
208 #define STMPE811_TSC_CFG_SETTLING_10US (0b000)
209 #define STMPE811_TSC_CFG_SETTLING_100US (0b001)
210 #define STMPE811_TSC_CFG_SETTLING_500US (0b010)
211 #define STMPE811_TSC_CFG_SETTLING_1MS (0b011)
212 #define STMPE811_TSC_CFG_SETTLING_5MS (0b100)
213 #define STMPE811_TSC_CFG_SETTLING_10MS (0b101)
214 #define STMPE811_TSC_CFG_SETTLING_50MS (0b110)
215 #define STMPE811_TSC_CFG_SETTLING_100MS (0b111)
222 #define STMPE811_FIFO_CTRL_STA_RESET (1 << 0)
229 #define STMPE811_TSC_FRACTION_Z_0_8 (0b000)
230 #define STMPE811_TSC_FRACTION_Z_1_7 (0b001)
231 #define STMPE811_TSC_FRACTION_Z_2_6 (0b010)
232 #define STMPE811_TSC_FRACTION_Z_3_5 (0b011)
233 #define STMPE811_TSC_FRACTION_Z_4_4 (0b100)
234 #define STMPE811_TSC_FRACTION_Z_5_3 (0b101)
235 #define STMPE811_TSC_FRACTION_Z_6_2 (0b110)
236 #define STMPE811_TSC_FRACTION_Z_7_1 (0b111)
243 #define STMPE811_TSC_I_DRIVE_50MA (1 << 0)
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif /* STMPE811_CONSTANTS_H */