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