eGUI alias D4D
Release 3.0
Reference Manual
Introduction
Pages
Reference
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
hw_iic_prv.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
***************************************************************************/
42
#ifndef _HW_D4D_I2C_PRV_H
43
#define _HW_D4D_I2C_PRV_H
44
45
46
47
/******************************************************************************
48
* Constants
49
******************************************************************************/
50
51
/******************************************************************************
52
* Macros
53
******************************************************************************/
54
55
#define SET(x) (x##_PORT) |= (1 << (x))
56
#define RESET(x) (x##_PORT) &= ~(1 << (x))
57
58
#define GET(x) ((x##_PORT) & ~(1 << (x)))
59
60
61
#define OUTPUT(x) (x##_DDR) |= (1 << (x)) ;
62
#define INPUT(x) (x##_DDR) &= ~(1 << (x));
63
64
#ifndef D4D_I2C_MCU_TYPE
65
#define D4D_I2C_MCU_TYPE D4D_I2C_MCU_TYPE_MK
66
#endif
67
68
#ifndef D4D_I2C_FREQ_REG
69
#define D4D_I2C_FREQ_REG 0x17
70
#endif
71
72
#ifndef D4D_I2C_FREQ_BUS
73
#define D4D_I2C_FREQ_BUS 50000000u
74
#endif
75
76
#ifndef D4D_I2C_PCR_PIN_GPIO
77
#define D4D_I2C_PCR_PIN_GPIO 1
78
#endif
79
80
#ifndef D4D_I2C_PCR_PIN_I2C
81
#define D4D_I2C_PCR_PIN_I2C 4
82
#endif
83
84
#ifndef D4D_I2C_SCL_PIN_ENABLE
85
#ifndef D4D_I2C_SCL_PCR
86
#error "The Macro D4D_I2C_SCL_PCR must be set in Touch Screen low level driver configuration file."
87
#else
88
#define D4D_I2C_SCL_PIN_ENABLE(alt) (D4D_I2C_SCL_PCR = PORT_PCR_MUX(alt) | PORT_PCR_ODE_MASK);
89
#endif
90
#endif
91
92
#ifndef D4D_I2C_INIT_SCL
93
#define D4D_I2C_INIT_SCL D4D_I2C_SCL_PIN_ENABLE(D4D_I2C_PCR_PIN_I2C);
94
#endif
95
96
#ifndef D4D_RESET_I2C_SCL
97
#ifndef D4D_I2C_SCL
98
#error "The Macro D4D_I2C_SCL must be set in Touch Screen low level driver configuration file."
99
#else
100
#define D4D_RESET_I2C_SCL RESET(D4D_I2C_SCL);
101
#endif
102
#endif
103
104
#ifndef D4D_SET_I2C_SCL
105
#ifndef D4D_I2C_SCL
106
#error "The Macro D4D_I2C_SCL must be set in Touch Screen low level driver configuration file."
107
#else
108
#define D4D_SET_I2C_SCL SET(D4D_I2C_SCL);
109
#endif
110
#endif
111
112
#ifndef D4D_SET_OUTPUT_I2C_SCL
113
#ifndef D4D_I2C_SCL
114
#error "The Macro D4D_I2C_SCL must be set in Touch Screen low level driver configuration file."
115
#else
116
#define D4D_SET_OUTPUT_I2C_SCL OUTPUT(D4D_I2C_SCL);
117
#endif
118
#endif
119
120
#ifndef SET_INPUT_D4D_I2C_SCL
121
#ifndef D4D_I2C_SCL
122
#error "The Macro D4D_I2C_SCL must be set in Touch Screen low level driver configuration file."
123
#else
124
#define SET_INPUT_D4D_I2C_SCL INPUT(D4D_I2C_SCL);
125
#endif
126
#endif
127
128
#ifndef GET_D4D_I2C_SCL
129
#ifndef D4D_I2C_SCL
130
#error "The Macro D4D_I2C_SCL must be set in Touch Screen low level driver configuration file."
131
#else
132
#define GET_D4D_I2C_SCL GET(D4D_I2C_SCL);
133
#endif
134
#endif
135
136
#ifndef D4D_I2C_SDA_PIN_ENABLE
137
#ifndef D4D_I2C_SDA_PCR
138
#error "The Macro D4D_I2C_SDA_PCR must be set in Touch Screen low level driver configuration file."
139
#else
140
#define D4D_I2C_SDA_PIN_ENABLE(alt) (D4D_I2C_SDA_PCR = PORT_PCR_MUX(alt) | PORT_PCR_ODE_MASK);
141
#endif
142
#endif
143
144
145
#ifndef D4D_I2C_INIT_SDA
146
#define D4D_I2C_INIT_SDA D4D_I2C_SDA_PIN_ENABLE(D4D_I2C_PCR_PIN_I2C)
147
#endif
148
149
#ifndef RESET_D4D_I2C_SDA
150
#ifndef D4D_I2C_SDA
151
#error "The Macro D4D_I2C_SDA must be set in Touch Screen low level driver configuration file."
152
#else
153
#define RESET_D4D_I2C_SDA RESET(D4D_I2C_SDA);
154
#endif
155
#endif
156
157
#ifndef SET_D4D_I2C_SDA
158
#ifndef D4D_I2C_SDA
159
#error "The Macro D4D_I2C_SDA must be set in Touch Screen low level driver configuration file."
160
#else
161
#define SET_D4D_I2C_SDA SET(D4D_I2C_SDA);
162
#endif
163
#endif
164
165
#ifndef SET_D4D_I2C_SDA
166
#ifndef D4D_I2C_SDA
167
#error "The Macro D4D_I2C_SDA must be set in Touch Screen low level driver configuration file."
168
#else
169
#define SET_D4D_I2C_SDA SET(D4D_I2C_SDA);
170
#endif
171
#endif
172
173
#ifndef D4D_SET_OUTPUT_I2C_SDA
174
#ifndef D4D_I2C_SDA
175
#error "The Macro D4D_I2C_SDA must be set in Touch Screen low level driver configuration file."
176
#else
177
#define D4D_SET_OUTPUT_I2C_SDA OUTPUT(D4D_I2C_SDA);
178
#endif
179
#endif
180
181
#ifndef D4D_SET_INPUT_I2C_SDA
182
#ifndef D4D_I2C_SDA
183
#error "The Macro D4D_I2C_SDA must be set in Touch Screen low level driver configuration file."
184
#else
185
#define D4D_SET_INPUT_I2C_SDA INPUT(D4D_I2C_SDA);
186
#endif
187
#endif
188
189
#ifndef D4D_GET_I2C_SDA
190
#ifndef D4D_I2C_SDA
191
#error "The Macro D4D_I2C_SDA must be set in Touch Screen low level driver configuration file."
192
#else
193
#define D4D_GET_I2C_SDA GET(D4D_I2C_SDA);
194
#endif
195
#endif
196
197
198
#ifndef D4D_I2C_DISABLE_COMPILATION
199
#define D4D_I2C_DISABLE_COMPILATION 0
200
#endif
201
202
#ifndef D4D_I2C_C1_I2CEN_MASK
203
#define D4D_I2C_C1_I2CEN_MASK 0x80u
204
#endif
205
206
#ifndef D4D_I2C_C1_MST_MASK
207
#define D4D_I2C_C1_MST_MASK 0x20u
208
#endif
209
210
#ifndef D4D_I2C_C1_TX_MASK
211
#define D4D_I2C_C1_TX_MASK 0x10u
212
#endif
213
214
#ifndef D4D_I2C_C1_TXAK_MASK
215
#define D4D_I2C_C1_TXAK_MASK 0x08u
216
#endif
217
218
#ifndef D4D_I2C_C1_RSTA_MASK
219
#define D4D_I2C_C1_RSTA_MASK 0x04u
220
#endif
221
222
223
#ifndef D4D_I2C_S_BUSY_MASK
224
#define D4D_I2C_S_BUSY_MASK 0x20u
225
#endif
226
227
#ifndef D4D_I2C_S_I2CIF_MASK
228
#define D4D_I2C_S_I2CIF_MASK 0x02u
229
#endif
230
231
#ifndef D4D_I2C_S_RXAK_MASK
232
#define D4D_I2C_S_RXAK_MASK 0x01u
233
#endif
234
235
#if (D4D_I2C_MCU_TYPE == D4D_I2C_MCU_TYPE_S08)
236
// S08
237
#error "S08 is currently unssuported MCU type for delay loop in loe level common driver!"
238
#elif (D4D_I2C_MCU_TYPE == D4D_I2C_MCU_TYPE_CV)
239
//ColdFire
240
#error "ColdFire is currently unssuported MCU type for delay loop in loe level common driver!"
241
#elif (D4D_I2C_MCU_TYPE == D4D_I2C_MCU_TYPE_MK)
242
// Kinetis
243
#define D4D_I2C_A1 I2C_A1_REG(D4D_I2C_BASE)
244
#define D4D_I2C_F I2C_F_REG(D4D_I2C_BASE)
245
#define D4D_I2C_C1 I2C_C1_REG(D4D_I2C_BASE)
246
#define D4D_I2C_S I2C_S_REG(D4D_I2C_BASE)
247
#define D4D_I2C_D I2C_D_REG(D4D_I2C_BASE)
248
#define D4D_I2C_C2 I2C_C2_REG(D4D_I2C_BASE)
249
#define D4D_I2C_FLT I2C_FLT_REG(D4D_I2C_BASE)
250
#define D4D_I2C_RA I2C_RA_REG(D4D_I2C_BASE)
251
#define D4D_I2C_SMB I2C_SMB_REG(D4D_I2C_BASE)
252
#define D4D_I2C_A2 I2C_A2_REG(D4D_I2C_BASE)
253
#define D4D_I2C_SLTH I2C_SLTH_REG(D4D_I2C_BASE)
254
#define D4D_I2C_SLTL I2C_SLTL_REG(D4D_I2C_BASE)
255
#else
256
#error "Unsupported MCU type for delay loop in low level common driver!"
257
#endif
258
259
/******************************************************************************
260
* Types
261
******************************************************************************/
262
263
/******************************************************************************
264
* Global functions
265
******************************************************************************/
266
267
#endif //_HW_D4D_I2C_PRV_H
GIT
PRIVATE
eGUI
D4D
low_level_drivers
touch_screen
touch_screen_drivers
cr_touch
iic
hw_iic_prv.h
Generated on Thu Sep 21 2017 08:47:44 for eGUI alias D4D by
1.8.5