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)
32 /* @name Registers
33  * @{
34  */
35 #define STMPE811_CHIP_ID (0x00)
36 #define STMPE811_ID_VER (0x02)
37 #define STMPE811_SYS_CTRL1 (0x03)
38 #define STMPE811_SYS_CTRL2 (0x04)
39 #define STMPE811_SPI_CFG (0x08)
40 #define STMPE811_INT_CTRL (0x09)
41 #define STMPE811_INT_EN (0x0A)
42 #define STMPE811_INT_STA (0x0B)
43 #define STMPE811_GPIO_EN (0x0C)
44 #define STMPE811_GPIO_INT_STA (0x0D)
45 #define STMPE811_ADC_INT_EN (0x0E)
46 #define STMPE811_ADC_INT_STA (0x0F)
47 #define STMPE811_GPIO_SET_PIN (0x10)
48 #define STMPE811_GPIO_CLR_PIN (0x11)
49 #define STMPE811_MP_STA (0x12)
50 #define STMPE811_GPIO_DIR (0x13)
51 #define STMPE811_GPIO_ED (0x14)
52 #define STMPE811_GPIO_RE (0x15)
53 #define STMPE811_GPIO_FE (0x16)
54 #define STMPE811_GPIO_ALT_FUNCTION (0x17)
55 #define STMPE811_ADC_CTRL1 (0x20)
56 #define STMPE811_ADC_CTRL2 (0x21)
57 #define STMPE811_ADC_CAPT (0x22)
58 #define STMPE811_ADC_DATA_CHO (0x30)
59 #define STMPE811_ADC_DATA_CH1 (0x32)
60 #define STMPE811_ADC_DATA_CH2 (0x34)
61 #define STMPE811_ADC_DATA_CH3 (0x36)
62 #define STMPE811_ADC_DATA_CH4 (0x38)
63 #define STMPE811_ADC_DATA_CH5 (0x3A)
64 #define STMPE811_ADC_DATA_CH6 (0x3C)
65 #define STMPE811_ADC_DATA_CH7 (0x3E)
66 #define STMPE811_TSC_CTRL (0x40)
67 #define STMPE811_TSC_CFG (0x41)
68 #define STMPE811_WDW_TR_X (0x42)
69 #define STMPE811_WDW_TR_Y (0x44)
70 #define STMPE811_WDW_BL_X (0x46)
71 #define STMPE811_WDW_BL_Y (0x48)
72 #define STMPE811_FIFO_TH (0x4A)
73 #define STMPE811_FIFO_CTRL_STA (0x4B)
74 #define STMPE811_FIFO_SIZE (0x4C)
75 #define STMPE811_TSC_DATA_X (0x4D)
76 #define STMPE811_TSC_DATA_Y (0x4F)
77 #define STMPE811_TSC_DATA_Z (0x51)
78 #define STMPE811_TSC_DATA_XYZ (0x52)
79 #define STMPE811_TSC_DATA_INC (0x57)
80 #define STMPE811_TSC_DATA_NON_INC (0xD7)
81 #define STMPE811_TSC_FRACTION_Z (0x56)
82 #define STMPE811_TSC_DATA (0x57)
83 #define STMPE811_TSC_I_DRIVE (0x58)
84 #define STMPE811_TSC_SHIELD (0x59)
85 #define STMPE811_TEMP_CTRL (0x60)
86 #define STMPE811_TEMP_DATA (0x61)
87 #define STMPE811_TEMP_TH (0x62)
90 /* @name SYS_CTRL1 register bitfields
91  * @{
92  */
93 #define STMPE811_SYS_CTRL1_HIBERNATE (1 << 0)
94 #define STMPE811_SYS_CTRL1_SOFT_RESET (1 << 1)
97 /* @name SYS_CTRL2 register bitfields
98  * @{
99  */
100 #define STMPE811_SYS_CTRL2_ADC_OFF (1 << 0)
101 #define STMPE811_SYS_CTRL2_TSC_OFF (1 << 1)
102 #define STMPE811_SYS_CTRL2_GPIO_OFF (1 << 2)
103 #define STMPE811_SYS_CTRL2_TS_OFF (1 << 3)
106 /* @name INT_CTRL register bitfields
107  * @{
108  */
109 #define STMPE811_INT_CTRL_INT_POLARITY (1 << 2)
110 #define STMPE811_INT_CTRL_INT_TYPE (1 << 1)
111 #define STMPE811_INT_CTRL_GLOBAL_INT (1 << 0)
114 /* @name INT_EN register bitfields
115  * @{
116  */
117 #define STMPE811_INT_EN_TOUCH_DET (1 << 0)
118 #define STMPE811_INT_EN_FIFO_TH (1 << 1)
119 #define STMPE811_INT_EN_FIFO_OFLOW (1 << 2)
120 #define STMPE811_INT_EN_FIFO_FULL (1 << 3)
121 #define STMPE811_INT_EN_FIFO_EMPTY (1 << 4)
122 #define STMPE811_INT_EN_TEMP_SENS (1 << 5)
123 #define STMPE811_INT_EN_ADC (1 << 6)
124 #define STMPE811_INT_EN_GPIO (1 << 7)
127 /* @name ADC_CTRL1 register bitfields
128  * @{
129  */
130 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_POS (4)
131 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_36 (0b000)
132 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_44 (0b001)
133 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_56 (0b010)
134 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_64 (0b011)
135 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_80 (0b100)
136 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_96 (0b101)
137 #define STMPE811_ADC_CTRL1_SAMPLE_TIME_124 (0b110)
138 #define STMPE811_ADC_CTRL1_MOD_12B (1 << 3)
141 /* @name ADC_CTRL2 register bitfields
142  * @{
143  */
144 #define STMPE811_ADC_CTRL2_FREQ_1_625MHZ (0b00)
145 #define STMPE811_ADC_CTRL2_FREQ_3_25MHZ (0b01)
146 #define STMPE811_ADC_CTRL2_FREQ_6_5MHZ (0b10)
147 #define STMPE811_ADC_CTRL2_FREQ_6_5_2MHZ (0b11)
150 /* @name TSC_CTRL register bitfields
151  * @{
152  */
153 #define STMPE811_TSC_CTRL_EN (1 << 0)
154 #define STMPE811_TSC_CTRL_OPMOD_POS (1)
155 #define STMPE811_TSC_CTRL_OPMOD_XYZ (0b000)
156 #define STMPE811_TSC_CTRL_OPMOD_XY_ONLY (0b001)
157 #define STMPE811_TSC_CTRL_OPMOD_X_ONLY (0b010)
158 #define STMPE811_TSC_CTRL_OPMOD_Y_ONLY (0b011)
159 #define STMPE811_TSC_CTRL_OPMOD_Z_ONLY (0b100)
160 #define STMPE811_TSC_CTRL_TRACK_POS (4)
161 #define STMPE811_TSC_CTRL_TRACK_NO (0b000)
162 #define STMPE811_TSC_CTRL_TRACK_4 (0b001)
163 #define STMPE811_TSC_CTRL_TRACK_8 (0b010)
164 #define STMPE811_TSC_CTRL_TRACK_16 (0b011)
165 #define STMPE811_TSC_CTRL_TRACK_32 (0b100)
166 #define STMPE811_TSC_CTRL_TRACK_64 (0b101)
167 #define STMPE811_TSC_CTRL_TRACK_92 (0b110)
168 #define STMPE811_TSC_CTRL_TRACK_127 (0b111)
169 #define STMPE811_TSC_CTRL_STA (1 << 7)
172 /* @name TSC_CFG register bitfields
173  * @{
174  */
175 #define STMPE811_TSC_CFG_AVE_CTRL_POS (6)
176 #define STMPE811_TSC_CFG_AVE_CTRL_1 (0b00)
177 #define STMPE811_TSC_CFG_AVE_CTRL_2 (0b01)
178 #define STMPE811_TSC_CFG_AVE_CTRL_4 (0b10)
179 #define STMPE811_TSC_CFG_AVE_CTRL_8 (0b11)
180 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_POS (3)
181 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_10US (0b000)
182 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_50US (0b001)
183 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_100US (0b010)
184 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_500US (0b011)
185 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_1MS (0b100)
186 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_5MS (0b101)
187 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_10MS (0b110)
188 #define STMPE811_TSC_CFG_TOUCH_DET_DELAY_50MS (0b111)
189 #define STMPE811_TSC_CFG_SETTLING_10US (0b000)
190 #define STMPE811_TSC_CFG_SETTLING_100US (0b001)
191 #define STMPE811_TSC_CFG_SETTLING_500US (0b010)
192 #define STMPE811_TSC_CFG_SETTLING_1MS (0b011)
193 #define STMPE811_TSC_CFG_SETTLING_5MS (0b100)
194 #define STMPE811_TSC_CFG_SETTLING_10MS (0b101)
195 #define STMPE811_TSC_CFG_SETTLING_50MS (0b110)
196 #define STMPE811_TSC_CFG_SETTLING_100MS (0b111)
199 /* @name FIFO_CTRL_STA register bitfields
200  * @{
201  */
202 #define STMPE811_FIFO_CTRL_STA_RESET (1 << 0)
205 /* @name TSC_FRACTION_Z register bitfields
206  * @{
207  */
208 #define STMPE811_TSC_FRACTION_Z_0_8 (0b000)
209 #define STMPE811_TSC_FRACTION_Z_1_7 (0b001)
210 #define STMPE811_TSC_FRACTION_Z_2_6 (0b010)
211 #define STMPE811_TSC_FRACTION_Z_3_5 (0b011)
212 #define STMPE811_TSC_FRACTION_Z_4_4 (0b100)
213 #define STMPE811_TSC_FRACTION_Z_5_3 (0b101)
214 #define STMPE811_TSC_FRACTION_Z_6_2 (0b110)
215 #define STMPE811_TSC_FRACTION_Z_7_1 (0b111)
218 /* @name TSC_I_DRIVE register bitfields
219  * @{
220  */
221 #define STMPE811_TSC_I_DRIVE_50MA (1 << 0)
224 #ifdef __cplusplus
225 }
226 #endif
227 
228 #endif /* STMPE811_CONSTANTS_H */
229 
stmpe811.h