eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4dlcdhw_s12_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 __D4DLCDHW_S12SPI16B_H
47 #define __D4DLCDHW_S12SPI16B_H
48 
49  #if (D4D_MK_STR(D4D_LLD_LCD_HW) == d4dlcdhw_s12_spi_16b_ID)
50 
51  /******************************************************************************
52  * Includes
53  ******************************************************************************/
54  #include "d4dlcdhw_s12_spi_16b_cfg.h"
55 
56  /******************************************************************************
57  * Constants
58  ******************************************************************************/
59 
60  /******************************************************************************
61  * Types
62  ******************************************************************************/
63 
64  /******************************************************************************
65  * Macros
66  ******************************************************************************/
67  #define SET(x) (x##_PORT) |= (1 << (x))
68  #define RESET(x) (x##_PORT) &= ~(1 << (x))
69 
70  #define OUTPUT(x) (x##_DDR) |= (1 << (x))
71  #define INPUT(x) (x##_DDR) &= ~(1 << (x))
72 
73  #ifndef D4DLCD_INIT_CS
74  #ifndef D4DLCD_CS
75  #error "The Macro D4DLCD_CS must be set in LCD low level driver configuration file."
76  #else
77  #define D4DLCD_INIT_CS OUTPUT(D4DLCD_CS);
78  #endif
79  #endif
80 
81  #ifndef D4DLCD_ASSERT_CS
82  #ifndef D4DLCD_CS
83  #error "The Macro D4DLCD_CS must be set in LCD low level driver configuration file."
84  #else
85  #define D4DLCD_ASSERT_CS RESET(D4DLCD_CS);
86  #endif
87  #endif
88 
89  #ifndef D4DLCD_DEASSERT_CS
90  #ifndef D4DLCD_CS
91  #error "The Macro D4DLCD_CS must be set in LCD low level driver configuration file."
92  #else
93  #define D4DLCD_DEASSERT_CS SET(D4DLCD_CS);
94  #endif
95  #endif
96 
97  #ifndef D4DLCD_INIT_DC
98  #ifndef D4DLCD_DC
99  #error "The Macro D4DLCD_DC must be set in LCD low level driver configuration file."
100  #else
101  #define D4DLCD_INIT_DC OUTPUT(D4DLCD_DC);
102  #endif
103  #endif
104 
105  #ifndef D4DLCD_ASSERT_DC
106  #ifndef D4DLCD_DC
107  #error "The Macro D4DLCD_DC must be set in LCD low level driver configuration file."
108  #else
109  #define D4DLCD_ASSERT_DC RESET(D4DLCD_DC);
110  #endif
111  #endif
112 
113  #ifndef D4DLCD_DEASSERT_DC
114  #ifndef D4DLCD_DC
115  #error "The Macro D4DLCD_DC must be set in LCD low level driver configuration file."
116  #else
117  #define D4DLCD_DEASSERT_DC SET(D4DLCD_DC);
118  #endif
119  #endif
120 
121  #ifdef D4DLCD_BACKLIGHT
122 
123  #ifndef D4DLCD_INIT_BACKLIGHT
124  #define D4DLCD_INIT_BACKLIGHT OUTPUT(D4DLCD_BACKLIGHT);
125  #endif
126 
127  #ifndef D4DLCD_ASSERT_BACKLIGHT
128  #define D4DLCD_ASSERT_BACKLIGHT RESET(D4DLCD_BACKLIGHT);
129  #endif
130 
131  #ifndef D4DLCD_DEASSERT_BACKLIGHT
132  #define D4DLCD_DEASSERT_BACKLIGHT SET(D4DLCD_BACKLIGHT);
133  #endif
134 
135  #endif
136 
137  #ifndef D4DLCD_INIT_RESET
138  #ifndef D4DLCD_RESET
139  #error "The Macro D4DLCD_RESET must be set in LCD low level driver configuration file."
140  #else
141  #define D4DLCD_INIT_RESET OUTPUT(D4DLCD_RESET);
142  #endif
143  #endif
144 
145  #ifndef D4DLCD_ASSERT_RESET
146  #ifndef D4DLCD_RESET
147  #error "The Macro D4DLCD_RESET must be set in LCD low level driver configuration file."
148  #else
149  #define D4DLCD_ASSERT_RESET RESET(D4DLCD_RESET);
150  #endif
151  #endif
152 
153  #ifndef D4DLCD_DEASSERT_RESET
154  #ifndef D4DLCD_RESET
155  #error "The Macro D4DLCD_RESET must be set in LCD low level driver configuration file."
156  #else
157  #define D4DLCD_DEASSERT_RESET SET(D4DLCD_RESET);
158  #endif
159  #endif
160 
161 
162  #if D4DLCD_COMM_HW_ID == 0
163  #define D4DLCD_SPIBR SPI0BR
164  #define D4DLCD_SPIC1 SPI0CR1
165  #define D4DLCD_SPIC2 SPI0CR2
166  #define D4DLCD_SPID SPI0DR
167  #define D4DLCD_SPIS_SPTEF SPI0SR_SPTEF
168  #define D4DLCD_SPIS_SPIF SPI0SR_SPIF
169  #elif D4DLCD_COMM_HW_ID == 1
170  #define D4DLCD_SPIBR SPI1BR
171  #define D4DLCD_SPIC1 SPI1CR1
172  #define D4DLCD_SPIC2 SPI1CR2
173  #define D4DLCD_SPID SPI1DR
174  #define D4DLCD_SPIS_SPTEF SPI1SR_SPTEF
175  #define D4DLCD_SPIS_SPIF SPI1SR_SPIF
176  #elif D4DLCD_COMM_HW_ID == 2
177  #define D4DLCD_SPIBR SPI2BR
178  #define D4DLCD_SPIC1 SPI2CR1
179  #define D4DLCD_SPIC2 SPI2CR2
180  #define D4DLCD_SPID SPI2DR
181  #define D4DLCD_SPIS_SPTEF SPI2SR_SPTEF
182  #define D4DLCD_SPIS_SPIF SPI2SR_SPIF
183  #elif D4DLCD_COMM_HW_ID == 3
184  #define D4DLCD_SPIBR SPI3BR
185  #define D4DLCD_SPIC1 SPI3CR1
186  #define D4DLCD_SPIC2 SPI3CR2
187  #define D4DLCD_SPID SPI3DR
188  #define D4DLCD_SPIS_SPTEF SPI3SR_SPTEF
189  #define D4DLCD_SPIS_SPIF SPI3SR_SPIF
190  //#define D4DLCD_READ_CMD_SUPPORT 0
191  #endif
192 
193  /******************************************************************************
194  * Global variables
195  ******************************************************************************/
196 
197  /******************************************************************************
198  * Global functions
199  ******************************************************************************/
200 
201  #endif
202 #endif /* __D4DLCDHW_S12SPI16B_H */
203 
204 
205 
206 
207 
208 
209 
210 
211 
212