eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4dtchhw_s08_adc.h
Go to the documentation of this file.
1 /**************************************************************************
2 *
3 * Copyright 2014 by Petr Gargulak. eGUI Community.
4 * Copyright 2009-2013 by Petr Gargulak. Freescale Semiconductor, Inc.
5 *
6 ***************************************************************************
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License Version 3
9 * or later (the "LGPL").
10 *
11 * As a special exception, the copyright holders of the eGUI project give you
12 * permission to link the eGUI sources with independent modules to produce an
13 * executable, regardless of the license terms of these independent modules,
14 * and to copy and distribute the resulting executable under terms of your
15 * choice, provided that you also meet, for each linked independent module,
16 * the terms and conditions of the license of that module.
17 * An independent module is a module which is not derived from or based
18 * on this library.
19 * If you modify the eGUI sources, you may extend this exception
20 * to your version of the eGUI sources, but you are not obligated
21 * to do so. If you do not wish to do so, delete this
22 * exception statement from your version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 *
28 * You should have received a copy of the GNU General Public License
29 * and the GNU Lesser General Public License along with this program.
30 * If not, see <http://www.gnu.org/licenses/>.
31 *
32 ***************************************************************************/
47 #ifndef __D4DTCHHW_S08_ADC_H
48 #define __D4DTCHHW_S08_ADC_H
49 
50  #if (D4D_MK_STR(D4D_LLD_TCH_HW) == d4dtchhw_s08_adc_ID)
51 
52  /******************************************************************************
53  * Includes
54  ******************************************************************************/
55  #include "d4dtchhw_s08_adc_cfg.h"
56 
57  /******************************************************************************
58  * Constants
59  ******************************************************************************/
60 
61  /******************************************************************************
62  * Types
63  ******************************************************************************/
64 
65  /******************************************************************************
66  * Macros
67  ******************************************************************************/
68 
69  #define SET(x) (x##_PORT) |= (1 << (x))
70  #define RESET(x) (x##_PORT) &= ~(1 << (x))
71 
72  #define OUTPUT(x) (x##_DDR) |= (1 << (x))
73  #define INPUT(x) (x##_DDR) &= ~(1 << (x))
74 
75  /****** X PLUS signal macros ******/
76 
77  #ifndef D4DTCH_INIT_X_PLUS
78  #ifndef D4DTCH_X_PLUS
79  #error "The Macro D4DTCH_X_PLUS must be set in Touch Screen low level driver configuration file."
80  #else
81  #define D4DTCH_INIT_X_PLUS OUTPUT(D4DTCH_X_PLUS); RESET(D4DTCH_X_PLUS);
82  #endif
83  #endif
84 
85  #ifndef D4DTCH_RESET_X_PLUS
86  #ifndef D4DTCH_X_PLUS
87  #error "The Macro D4DTCH_X_PLUS must be set in Touch Screen low level driver configuration file."
88  #else
89  #define D4DTCH_RESET_X_PLUS RESET(D4DTCH_X_PLUS);
90  #endif
91  #endif
92 
93  #ifndef D4DTCH_SET_X_PLUS
94  #ifndef D4DTCH_X_PLUS
95  #error "The Macro D4DTCH_X_PLUS must be set in Touch Screen low level driver configuration file."
96  #else
97  #define D4DTCH_SET_X_PLUS SET(D4DTCH_X_PLUS);
98  #endif
99  #endif
100 
101  /****** X MINUS signal macros ******/
102 
103  #ifndef D4DTCH_INIT_X_MINUS
104  #ifndef D4DTCH_X_MINUS
105  #error "The Macro D4DTCH_X_MINUS must be set in Touch Screen low level driver configuration file."
106  #else
107  #define D4DTCH_INIT_X_MINUS OUTPUT(D4DTCH_X_MINUS); RESET(D4DTCH_X_MINUS);
108  #endif
109  #endif
110 
111  #ifndef D4DTCH_RESET_X_MINUS
112  #ifndef D4DTCH_X_MINUS
113  #error "The Macro D4DTCH_X_MINUS must be set in Touch Screen low level driver configuration file."
114  #else
115  #define D4DTCH_RESET_X_MINUS RESET(D4DTCH_X_MINUS);
116  #endif
117  #endif
118 
119  #ifndef D4DTCH_SET_X_MINUS
120  #ifndef D4DTCH_X_MINUS
121  #error "The Macro D4DTCH_X_MINUS must be set in Touch Screen low level driver configuration file."
122  #else
123  #define D4DTCH_SET_X_MINUS SET(D4DTCH_X_MINUS);
124  #endif
125  #endif
126 
127  #ifndef D4DTCH_X_MINUS_HIGH_Z_ENABLE
128  #ifndef D4DTCH_X_MINUS
129  #error "The Macro D4DTCH_X_MINUS must be set in Touch Screen low level driver configuration file."
130  #else
131  #define D4DTCH_X_MINUS_HIGH_Z_ENABLE INPUT(D4DTCH_X_MINUS);
132  #endif
133  #endif
134 
135  #ifndef D4DTCH_X_MINUS_HIGH_Z_DISABLE
136  #ifndef D4DTCH_X_MINUS
137  #error "The Macro D4DTCH_X_MINUS must be set in Touch Screen low level driver configuration file."
138  #else
139  #define D4DTCH_X_MINUS_HIGH_Z_DISABLE OUTPUT(D4DTCH_X_MINUS);
140  #endif
141  #endif
142 
143  /****** Y PLUS signal macros ******/
144 
145  #ifndef D4DTCH_INIT_Y_PLUS
146  #ifndef D4DTCH_Y_PLUS
147  #error "The Macro D4DTCH_Y_PLUS must be set in Touch Screen low level driver configuration file."
148  #else
149  #define D4DTCH_INIT_Y_PLUS OUTPUT(D4DTCH_Y_PLUS); RESET(D4DTCH_Y_PLUS);
150  #endif
151  #endif
152 
153  #ifndef D4DTCH_RESET_Y_PLUS
154  #ifndef D4DTCH_Y_PLUS
155  #error "The Macro D4DTCH_Y_PLUS must be set in Touch Screen low level driver configuration file."
156  #else
157  #define D4DTCH_RESET_Y_PLUS RESET(D4DTCH_Y_PLUS);
158  #endif
159  #endif
160 
161  #ifndef D4DTCH_SET_Y_PLUS
162  #ifndef D4DTCH_Y_PLUS
163  #error "The Macro D4DTCH_Y_PLUS must be set in Touch Screen low level driver configuration file."
164  #else
165  #define D4DTCH_SET_Y_PLUS SET(D4DTCH_Y_PLUS);
166  #endif
167  #endif
168 
169  /****** Y MINUS signal macros ******/
170 
171  #ifndef D4DTCH_INIT_Y_MINUS
172  #ifndef D4DTCH_Y_MINUS
173  #error "The Macro D4DTCH_Y_MINUS must be set in Touch Screen low level driver configuration file."
174  #else
175  #define D4DTCH_INIT_Y_MINUS OUTPUT(D4DTCH_Y_MINUS); RESET(D4DTCH_Y_MINUS);
176  #endif
177  #endif
178 
179  #ifndef D4DTCH_RESET_Y_MINUS
180  #ifndef D4DTCH_Y_MINUS
181  #error "The Macro D4DTCH_Y_MINUS must be set in Touch Screen low level driver configuration file."
182  #else
183  #define D4DTCH_RESET_Y_MINUS RESET(D4DTCH_Y_MINUS);
184  #endif
185  #endif
186 
187  #ifndef D4DTCH_SET_Y_MINUS
188  #ifndef D4DTCH_Y_MINUS
189  #error "The Macro D4DTCH_Y_MINUS must be set in Touch Screen low level driver configuration file."
190  #else
191  #define D4DTCH_SET_Y_MINUS SET(D4DTCH_Y_MINUS);
192  #endif
193  #endif
194 
195  #ifndef D4DTCH_Y_MINUS_HIGH_Z_ENABLE
196  #ifndef D4DTCH_Y_MINUS
197  #error "The Macro D4DTCH_Y_MINUS must be set in Touch Screen low level driver configuration file."
198  #else
199  #define D4DTCH_Y_MINUS_HIGH_Z_ENABLE INPUT(D4DTCH_Y_MINUS);
200  #endif
201  #endif
202 
203  #ifndef D4DTCH_Y_MINUS_HIGH_Z_DISABLE
204  #ifndef D4DTCH_Y_MINUS
205  #error "The Macro D4DTCH_Y_MINUS must be set in Touch Screen low level driver configuration file."
206  #else
207  #define D4DTCH_Y_MINUS_HIGH_Z_DISABLE OUTPUT(D4DTCH_Y_MINUS);
208  #endif
209  #endif
210 
211 
212  #ifndef D4D_TCHHW_ADCH
213  #define D4D_TCHHW_ADCH ADCSC1_ADCH
214  #endif
215 
216  #ifndef D4D_TCHHW_ADCCFG
217  #define D4D_TCHHW_ADCCFG ADCCFG
218  #endif
219 
220  #ifndef D4D_TCHHW_ADCR
221  #define D4D_TCHHW_ADCR ADCR
222  #endif
223 
224  #ifndef D4D_TCHHW_ADCSC1_COCO
225  #define D4D_TCHHW_ADCSC1_COCO ADCSC1_COCO
226  #endif
227 
228  #ifndef D4D_TCHHW_ADCSC2_ADACT
229  #define D4D_TCHHW_ADCSC2_ADACT ADCSC2_ADACT
230  #endif
231 
232  #ifndef D4D_TCHHW_ADC_INIT
233  #define D4D_TCHHW_ADC_INIT D4D_TCHHW_ADCCFG = 0x04;
234  #endif
235 
236 
237 
238 
239  /****** Algorithm constants/macros *****/
240 
241  #ifndef D4DTCH_FULL_SCALE
242  #define D4DTCH_FULL_SCALE 0x0FFF
243  #endif
244 
245  #ifndef D4DTCH_X_TOUCH_MIN
246  #define D4DTCH_X_TOUCH_MIN (D4DTCH_FULL_SCALE / 10)
247  #endif
248 
249  #ifndef D4DTCH_Y_TOUCH_MIN
250  #define D4DTCH_Y_TOUCH_MIN (D4DTCH_FULL_SCALE / 10)
251  #endif
252 
253  #ifndef D4DTCH_X_TOUCH_OFFMAX
254  #define D4DTCH_X_TOUCH_OFFMAX (D4DTCH_X_TOUCH_MIN * 4 / 2)
255  #endif
256 
257  #ifndef D4DTCH_Y_TOUCH_OFFMAX
258  #define D4DTCH_Y_TOUCH_OFFMAX (D4DTCH_Y_TOUCH_MIN * 4 / 2)
259  #endif
260 
261  #ifndef D4DTCH_SAMPLE_MARGIN
262  #define D4DTCH_SAMPLE_MARGIN (D4DTCH_FULL_SCALE / 256)
263  #endif
264 
265 
266 
267 
268 
269  /******************************************************************************
270  * Global variables
271  ******************************************************************************/
272 
273  /******************************************************************************
274  * Global functions
275  ******************************************************************************/
276 
277  #endif
278 #endif /* __D4DTCHHW_S08_ADC_H */
279 
280 
281 
282 
283 
284 
285 
286 
287 
288