eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4dlcdhw_spi_8b.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 ***************************************************************************/
46 #ifndef __D4DRVHW_SPI_8B_H
47 #define __D4DRVHW_SPI_8B_H
48 
49 #if (D4D_MK_STR(D4D_LLD_LCD_HW) == d4dlcdhw_spi_8b_ID)
50 
51 
52  /******************************************************************************
53  * Includes
54  ******************************************************************************/
55  #include "d4dlcdhw_spi_8b_cfg.h"
56 
57  /******************************************************************************
58  * Macros
59  ******************************************************************************/
60 
61  #define SET(x) (x##_PORT) |= (1 << (x))
62  #define RESET(x) (x##_PORT) &= ~(1 << (x))
63 
64  #define OUTPUT(x) (x##_DDR) |= (1 << (x))
65  #define INPUT(x) (x##_DDR) &= ~(1 << (x))
66 
67 
68  /******************************************************************************
69  * Constants
70  ******************************************************************************/
71 
72  #ifndef D4DLCD_INIT_CS
73  #ifndef D4DLCD_CS
74  #error "The Macro D4DLCD_CS must be set in LCD low level driver configuration file."
75  #else
76  #define D4DLCD_INIT_CS OUTPUT(D4DLCD_CS);
77  #endif
78  #endif
79 
80  #ifndef D4DLCD_ASSERT_CS
81  #ifndef D4DLCD_CS
82  #error "The Macro D4DLCD_CS must be set in LCD low level driver configuration file."
83  #else
84  #define D4DLCD_ASSERT_CS RESET(D4DLCD_CS);
85  #endif
86  #endif
87 
88  #ifndef D4DLCD_DEASSERT_CS
89  #ifndef D4DLCD_CS
90  #error "The Macro D4DLCD_CS must be set in LCD low level driver configuration file."
91  #else
92  #define D4DLCD_DEASSERT_CS SET(D4DLCD_CS);
93  #endif
94  #endif
95 
96  #ifndef D4DLCD_INIT_DC
97  #ifndef D4DLCD_DC
98  #error "The Macro D4DLCD_DC must be set in LCD low level driver configuration file."
99  #else
100  #define D4DLCD_INIT_DC OUTPUT(D4DLCD_DC);
101  #endif
102  #endif
103 
104  #ifndef D4DLCD_ASSERT_DC
105  #ifndef D4DLCD_DC
106  #error "The Macro D4DLCD_DC must be set in LCD low level driver configuration file."
107  #else
108  #define D4DLCD_ASSERT_DC RESET(D4DLCD_DC);
109  #endif
110  #endif
111 
112  #ifndef D4DLCD_DEASSERT_DC
113  #ifndef D4DLCD_DC
114  #error "The Macro D4DLCD_DC must be set in LCD low level driver configuration file."
115  #else
116  #define D4DLCD_DEASSERT_DC SET(D4DLCD_DC);
117  #endif
118  #endif
119 
120 
121  #ifndef D4DLCD_READ_CMD_SUPPORT
122  #define D4DLCD_READ_CMD_SUPPORT D4D_FALSE
123  #endif
124 
125  #if D4DLCD_COMM_HW_ID == 0
126  #define D4DLCD_SPIBR SPIBR
127  #define D4DLCD_SPIC1 SPIC1
128  #define D4DLCD_SPIC2 SPIC2
129  #define D4DLCD_SPID SPID
130  #define D4DLCD_SPIS SPIS
131  #define D4DLCD_SPIS_SPTEF SPIS_SPTEF
132  #define D4DLCD_SPIS_SPRF SPIS_SPRF
133  #elif D4DLCD_COMM_HW_ID == 1
134  #define D4DLCD_SPIBR SPI1BR
135  #define D4DLCD_SPIC1 SPI1C1
136  #define D4DLCD_SPIC2 SPI1C2
137  #define D4DLCD_SPID SPI1D
138  #define D4DLCD_SPIS SPI1S
139  #define D4DLCD_SPIS_SPTEF SPI1S_SPTEF
140  #define D4DLCD_SPIS_SPRF SPI1S_SPRF
141  #elif D4DLCD_COMM_HW_ID == 2
142  #define D4DLCD_SPIBR SPI2BR
143  #define D4DLCD_SPIC1 SPI2C1
144  #define D4DLCD_SPIC2 SPI2C2
145  #define D4DLCD_SPID SPI2D
146  #define D4DLCD_SPIS SPI2S
147  #define D4DLCD_SPIS_SPTEF SPI2S_SPTEF
148  #define D4DLCD_SPIS_SPRF SPI2S_SPRF
149  #elif D4DLCD_COMM_HW_ID == 3
150  #define D4DLCD_SPIBR SPI3BR
151  #define D4DLCD_SPIC1 SPI3C1
152  #define D4DLCD_SPIC2 SPI3C2
153  #define D4DLCD_SPID SPI3D
154  #define D4DLCD_SPIS SPI3S
155  #define D4DLCD_SPIS_SPTEF SPI3S_SPTEF
156  #define D4DLCD_SPIS_SPRF SPI3S_SPRF
157  #endif
158 
159  #ifdef D4DLCD_BACKLIGHT
160 
161  #ifndef D4DLCD_INIT_BACKLIGHT
162  #define D4DLCD_INIT_BACKLIGHT OUTPUT(D4DLCD_BACKLIGHT);
163  #endif
164 
165  #ifndef D4DLCD_ASSERT_BACKLIGHT
166  #define D4DLCD_ASSERT_BACKLIGHT RESET(D4DLCD_BACKLIGHT);
167  #endif
168 
169  #ifndef D4DLCD_DEASSERT_BACKLIGHT
170  #define D4DLCD_DEASSERT_BACKLIGHT SET(D4DLCD_BACKLIGHT);
171  #endif
172 
173  #endif
174 
175  #ifndef D4DLCD_INIT_RESET
176  #ifndef D4DLCD_RESET
177  #error "The Macro D4DLCD_RESET must be set in LCD low level driver configuration file."
178  #else
179  #define D4DLCD_INIT_RESET OUTPUT(D4DLCD_RESET);
180  #endif
181  #endif
182 
183  #ifndef D4DLCD_ASSERT_RESET
184  #ifndef D4DLCD_RESET
185  #error "The Macro D4DLCD_RESET must be set in LCD low level driver configuration file."
186  #else
187  #define D4DLCD_ASSERT_RESET RESET(D4DLCD_RESET);
188  #endif
189  #endif
190 
191  #ifndef D4DLCD_DEASSERT_RESET
192  #ifndef D4DLCD_RESET
193  #error "The Macro D4DLCD_RESET must be set in LCD low level driver configuration file."
194  #else
195  #define D4DLCD_DEASSERT_RESET SET(D4DLCD_RESET);
196  #endif
197  #endif
198 
199  /******************************************************************************
200  * Types
201  ******************************************************************************/
202 
203  /******************************************************************************
204  * Macros
205  ******************************************************************************/
206 
207  /******************************************************************************
208  * Global variables
209  ******************************************************************************/
210 
211  /******************************************************************************
212  * Global functions
213  ******************************************************************************/
214 
215 #endif
216 #endif /* __D4DRVHW_SPI_8B_H */
217 
218 
219 
220 
221 
222 
223 
224 
225 
226