CARME-M4 BSP  V1.5
lcd_conf.h
Go to the documentation of this file.
1 #ifndef __LCD_CONF_H__
2 #define __LCD_CONF_H__
3 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif /* __cplusplus */
77 
78 
79 #define TFT320x240
80 //#define TFT800x480
81 //#define TFT640x480
82 //#define TFTCUSTOM
83 
84 #define TFT_FPS 50ULL
85 
86 #ifdef TFTCUSTOM
87 #define TFT_WIDTH 0ULL
88 #define TFT_HSYNC_BACK_PORCH 0ULL
89 #define TFT_HSYNC_FRONT_PORCH 0ULL
90 #define TFT_HSYNC_PULSE 0ULL
91 
92 #define TFT_HEIGHT 0ULL
93 #define TFT_VSYNC_BACK_PORCH 0ULL
94 #define TFT_VSYNC_FRONT_PORCH 0ULL
95 #define TFT_VSYNC_PULSE 0ULL
96 #endif
97 
98 #ifdef TFT320x240
99 #define TFT_WIDTH 320ULL
100 #define TFT_HSYNC_BACK_PORCH 40ULL
101 #define TFT_HSYNC_FRONT_PORCH 20ULL
102 #define TFT_HSYNC_PULSE 28ULL
103 
104 #define TFT_HEIGHT 240ULL
105 #define TFT_VSYNC_BACK_PORCH 17ULL
106 #define TFT_VSYNC_FRONT_PORCH 4ULL
107 #define TFT_VSYNC_PULSE 3ULL
108 #endif
109 
110 #ifdef TFT800x480
111 #define TFT_WIDTH 800ULL
112 #define TFT_HSYNC_BACK_PORCH 30LL
113 #define TFT_HSYNC_FRONT_PORCH 0ULL
114 #define TFT_HSYNC_PULSE 0ULL
115 
116 #define TFT_HEIGHT 480ULL
117 #define TFT_VSYNC_BACK_PORCH 10ULL
118 #define TFT_VSYNC_FRONT_PORCH 0ULL
119 #define TFT_VSYNC_PULSE 0ULL
120 #endif
121 
122 #ifdef TFT640x480
123 
124 #define TFT_WIDTH 640ULL
125 #define TFT_HSYNC_BACK_PORCH 56ULL
126 #define TFT_HSYNC_FRONT_PORCH 8ULL
127 #define TFT_HSYNC_PULSE 96ULL
128 
129 #define TFT_HEIGHT 480ULL
130 #define TFT_VSYNC_BACK_PORCH 41ULL
131 #define TFT_VSYNC_FRONT_PORCH 2ULL
132 #define TFT_VSYNC_PULSE 2ULL
133 #endif
134 
135 #define TFT_HSYNC_PERIOD (TFT_HSYNC_PULSE + TFT_HSYNC_BACK_PORCH + TFT_WIDTH + TFT_HSYNC_FRONT_PORCH)
136 #define TFT_VSYNC_PERIOD (TFT_VSYNC_PULSE + TFT_VSYNC_BACK_PORCH + TFT_HEIGHT + TFT_VSYNC_FRONT_PORCH)
137 #define TFT_PCLK (TFT_HSYNC_PERIOD * TFT_VSYNC_PERIOD * TFT_FPS)
138 #define LCD_FPR ((TFT_PCLK * 1048576)/100000000)
139 
140 #define WR_HIGH_BYTE(x) (x >> 8)
141 #define WR_LOW_BYTE(x) (x & 0xFF)
142 
143 #define USE_16BIT_PMP
144 
145 /*********************************************************************
146  * Overview: Horizontal and vertical display resolution
147  * (from the glass datasheet).
148  *********************************************************************/
149 #define LCD_HOR_RESOLUTION 320ULL
150 #define LCD_VER_RESOLUTION 240ULL
151 
152 /*********************************************************************
153  * Overview: Horizontal synchronization timing in pixels
154  * (from the glass datasheet).
155  *********************************************************************/
156 #define LCD_HOR_PULSE_WIDTH 64ULL /* 64 */
157 #define LCD_HOR_BACK_PORCH 96ULL /* 96 */
158 #define LCD_HOR_FRONT_PORCH 48ULL /* 48 */
159 
160 /*********************************************************************
161  * Overview: Vertical synchronization timing in lines
162  * (from the glass datasheet).
163  *********************************************************************/
164 #define LCD_VER_PULSE_WIDTH 2ULL /* 2 */
165 #define LCD_VER_BACK_PORCH 34ULL /* 34 */
166 #define LCD_VER_FRONT_PORCH 11ULL /* 11 */
167 
168 /*********************************************************************
169  Define horizontal timing
170  HT - horizontal period
171  HPS - hsync width + front porch
172  HPW - horizontal sync pulse width
173  LPS - horizontal sync pulse location
174  *********************************************************************/
175 #define HT (LCD_HOR_RESOLUTION + LCD_HOR_PULSE_WIDTH + LCD_HOR_BACK_PORCH + LCD_HOR_FRONT_PORCH)
176 #define HPS (LCD_HOR_PULSE_WIDTH + LCD_HOR_BACK_PORCH)
177 
178 /*********************************************************************
179  Define vertical timing
180  VT - vertical period
181  VPS - vsync width + front porch
182  VPW - vertical sync pulse width
183  FPS - vertical sync pulse location
184  *********************************************************************/
185 #define VT (LCD_VER_PULSE_WIDTH + LCD_VER_BACK_PORCH + LCD_VER_FRONT_PORCH + LCD_VER_RESOLUTION)
186 #define VSP (LCD_VER_PULSE_WIDTH + LCD_VER_BACK_PORCH)
187 
188 /* LCD screen and bitmap image array constants */
189 #define X_BYTES 40
190 #define Y_BYTES 30
191 #define SCRN_LEFT 0
192 #define SCRN_TOP 0
193 #define SCRN_RIGHT LCD_HOR_RESOLUTION-1
194 #define SCRN_BOTTOM LCD_VER_RESOLUTION-1
195 
196 #define CCW -1
197 #define CW 1
198 
199 #define DOTS_PER_CM_X 64
200 #define DOTS_PER_CM_Y 60
201 
202 #define INCR 1
203 #define DECR -1
204 #define PREDX 1
205 #define PREDY 0
206 
207 /* 1.5 pixels for 1 mm (when width[mm]= 2.0mm then width[pixels]= 2*1.5= 3 pixels */
208 #define COEFF_PIXELS_MM 1.5
209 
210 
211 #ifdef __cplusplus
212 }
213 #endif /* __cplusplus */
214 
220 #endif /* __LCD_CONF_H__ */