Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /***************************************************************************** |
2 | * Module for Microchip Graphics Library |
||
3 | * LCD controller driver |
||
4 | * LG LGDP4531 |
||
5 | * Renesas R61505 |
||
6 | * Renesas R61580 |
||
7 | * Samsung S6D0129 |
||
8 | * Samsung S6D0139 |
||
9 | * Orise Tech. SPFD5408 |
||
10 | * Ilitek ILI9320 |
||
11 | ***************************************************************************** |
||
12 | * FileName: drvTFT001.h |
||
13 | * Dependencies: p24Fxxxx.h or plib.h |
||
14 | * Processor: PIC24, PIC32 |
||
15 | * Compiler: MPLAB C30, MPLAB C32 |
||
16 | * Linker: MPLAB LINK30, MPLAB LINK32 |
||
17 | * Company: Microchip Technology Incorporated |
||
18 | * |
||
19 | * Software License Agreement |
||
20 | * |
||
21 | * Copyright © 2008 Microchip Technology Inc. All rights reserved. |
||
22 | * Microchip licenses to you the right to use, modify, copy and distribute |
||
23 | * Software only when embedded on a Microchip microcontroller or digital |
||
24 | * signal controller, which is integrated into your product or third party |
||
25 | * product (pursuant to the sublicense terms in the accompanying license |
||
26 | * agreement). |
||
27 | * |
||
28 | * You should refer to the license agreement accompanying this Software |
||
29 | * for additional information regarding your rights and obligations. |
||
30 | * |
||
31 | * SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY |
||
32 | * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY |
||
33 | * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR |
||
34 | * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR |
||
35 | * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, |
||
36 | * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT |
||
37 | * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, |
||
38 | * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, |
||
39 | * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY |
||
40 | * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), |
||
41 | * OR OTHER SIMILAR COSTS. |
||
42 | * |
||
43 | * Author Date Comment |
||
44 | *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
45 | * Anton Alkhimenok 01/29/08 |
||
46 | * Sean Justice 01/31/08 combined portrait and landscape, PIC32 support |
||
47 | * Anton Alkhimenok 06/26/09 16-bit PMP support |
||
48 | *****************************************************************************/ |
||
49 | #ifndef _DRVTFT001_H |
||
50 | #define _DRVTFT001_H |
||
51 | |||
52 | #if defined(__dsPIC33F__) |
||
53 | #include <p33Fxxxx.h> |
||
54 | #elif defined(__PIC24H__) |
||
55 | #include <p24Hxxxx.h> |
||
56 | #elif defined(__PIC32MX__) |
||
57 | #include <plib.h> |
||
58 | #define PMDIN1 PMDIN |
||
59 | #elif defined(__PIC24F__) |
||
60 | #include <p24Fxxxx.h> |
||
61 | #else |
||
62 | #error CONTROLLER IS NOT SUPPORTED |
||
63 | #endif |
||
64 | #include "GraphicsConfig.h" |
||
65 | #include "GenericTypeDefs.h" |
||
66 | |||
67 | /********************************************************************* |
||
68 | * Overview: Additional hardware-accelerated functions can be implemented |
||
69 | * in the driver. These definitions exclude the PutPixel()-based |
||
70 | * functions in the primitives layer (Primitive.c file) from compilation. |
||
71 | *********************************************************************/ |
||
72 | |||
73 | // Define this to implement Font related functions in the driver. |
||
74 | //#define USE_DRV_FONT |
||
75 | // Define this to implement Line function in the driver. |
||
76 | //#define USE_DRV_LINE |
||
77 | // Define this to implement Circle function in the driver. |
||
78 | //#define USE_DRV_CIRCLE |
||
79 | // Define this to implement FillCircle function in the driver. |
||
80 | //#define USE_DRV_FILLCIRCLE |
||
81 | // Define this to implement Bar function in the driver. |
||
82 | #define USE_DRV_BAR |
||
83 | |||
84 | // Define this to implement ClearDevice function in the driver. |
||
85 | #define USE_DRV_CLEARDEVICE |
||
86 | |||
87 | // Define this to implement PutImage function in the driver. |
||
88 | #define USE_DRV_PUTIMAGE |
||
89 | |||
90 | #ifndef DISP_HOR_RESOLUTION |
||
91 | #error DISP_HOR_RESOLUTION must be defined in HardwareProfile.h |
||
92 | #endif |
||
93 | #ifndef DISP_VER_RESOLUTION |
||
94 | #error DISP_VER_RESOLUTION must be defined in HardwareProfile.h |
||
95 | #endif |
||
96 | #ifndef COLOR_DEPTH |
||
97 | #error COLOR_DEPTH must be defined in HardwareProfile.h |
||
98 | #endif |
||
99 | #ifndef DISP_ORIENTATION |
||
100 | #error DISP_ORIENTATION must be defined in HardwareProfile.h |
||
101 | #endif |
||
102 | |||
103 | /********************************************************************* |
||
104 | * Overview: Horizontal and vertical screen size. |
||
105 | *********************************************************************/ |
||
106 | #if (DISP_HOR_RESOLUTION != 240) |
||
107 | #error This driver doesn't supports this resolution. Horisontal resolution must be 240 pixels. |
||
108 | #endif |
||
109 | #if (DISP_VER_RESOLUTION != 320) |
||
110 | #error This driver doesn't supports this resolution. Vertical resolution must be 320 pixels. |
||
111 | #endif |
||
112 | |||
113 | /********************************************************************* |
||
114 | * Overview: Display orientation. |
||
115 | *********************************************************************/ |
||
116 | #if (DISP_ORIENTATION != 0) && (DISP_ORIENTATION != 90) |
||
117 | #error This driver doesn't support this orientation. |
||
118 | #endif |
||
119 | |||
120 | /********************************************************************* |
||
121 | * Overview: Color depth. |
||
122 | *********************************************************************/ |
||
123 | #if (COLOR_DEPTH != 16) |
||
124 | #error This driver doesn't support this color depth. It should be 16. |
||
125 | #endif |
||
126 | |||
127 | /********************************************************************* |
||
128 | * Overview: Clipping region control codes to be used with SetClip(...) |
||
129 | * function. |
||
130 | *********************************************************************/ |
||
131 | #define CLIP_DISABLE 0 // Disables clipping. |
||
132 | #define CLIP_ENABLE 1 // Enables clipping. |
||
133 | |||
134 | /********************************************************************* |
||
135 | * Overview: Some basic colors definitions. |
||
136 | *********************************************************************/ |
||
137 | #define BLACK RGB565CONVERT(0, 0, 0) |
||
138 | #define BRIGHTBLUE RGB565CONVERT(0, 0, 255) |
||
139 | #define BRIGHTGREEN RGB565CONVERT(0, 255, 0) |
||
140 | #define BRIGHTCYAN RGB565CONVERT(0, 255, 255) |
||
141 | #define BRIGHTRED RGB565CONVERT(255, 0, 0) |
||
142 | #define BRIGHTMAGENTA RGB565CONVERT(255, 0, 255) |
||
143 | #define BRIGHTYELLOW RGB565CONVERT(255, 255, 0) |
||
144 | #define BLUE RGB565CONVERT(0, 0, 128) |
||
145 | #define GREEN RGB565CONVERT(0, 128, 0) |
||
146 | #define CYAN RGB565CONVERT(0, 128, 128) |
||
147 | #define RED RGB565CONVERT(128, 0, 0) |
||
148 | #define MAGENTA RGB565CONVERT(128, 0, 128) |
||
149 | #define BROWN RGB565CONVERT(255, 128, 0) |
||
150 | #define LIGHTGRAY RGB565CONVERT(128, 128, 128) |
||
151 | #define DARKGRAY RGB565CONVERT(64, 64, 64) |
||
152 | #define LIGHTBLUE RGB565CONVERT(128, 128, 255) |
||
153 | #define LIGHTGREEN RGB565CONVERT(128, 255, 128) |
||
154 | #define LIGHTCYAN RGB565CONVERT(128, 255, 255) |
||
155 | #define LIGHTRED RGB565CONVERT(255, 128, 128) |
||
156 | #define LIGHTMAGENTA RGB565CONVERT(255, 128, 255) |
||
157 | #define YELLOW RGB565CONVERT(255, 255, 128) |
||
158 | #define WHITE RGB565CONVERT(255, 255, 255) |
||
159 | #define GRAY0 RGB565CONVERT(224, 224, 224) |
||
160 | #define GRAY1 RGB565CONVERT(192, 192, 192) |
||
161 | #define GRAY2 RGB565CONVERT(160, 160, 160) |
||
162 | #define GRAY3 RGB565CONVERT(128, 128, 128) |
||
163 | #define GRAY4 RGB565CONVERT(96, 96, 96) |
||
164 | #define GRAY5 RGB565CONVERT(64, 64, 64) |
||
165 | #define GRAY6 RGB565CONVERT(32, 32, 32) |
||
166 | |||
167 | // Memory pitch for line |
||
168 | #define LINE_MEM_PITCH 0x100 |
||
169 | |||
170 | // Color |
||
171 | extern WORD _color; |
||
172 | |||
173 | /********************************************************************* |
||
174 | * Overview: Clipping region control and border settings. |
||
175 | * |
||
176 | *********************************************************************/ |
||
177 | |||
178 | // Clipping region enable control |
||
179 | extern SHORT _clipRgn; |
||
180 | |||
181 | // Left clipping region border |
||
182 | extern SHORT _clipLeft; |
||
183 | |||
184 | // Top clipping region border |
||
185 | extern SHORT _clipTop; |
||
186 | |||
187 | // Right clipping region border |
||
188 | extern SHORT _clipRight; |
||
189 | |||
190 | // Bottom clipping region border |
||
191 | extern SHORT _clipBottom; |
||
192 | |||
193 | /********************************************************************* |
||
194 | * Function: void ResetDevice() |
||
195 | * |
||
196 | * Overview: Initializes LCD module. |
||
197 | * |
||
198 | * PreCondition: none |
||
199 | * |
||
200 | * Input: none |
||
201 | * |
||
202 | * Output: none |
||
203 | * |
||
204 | * Side Effects: none |
||
205 | * |
||
206 | ********************************************************************/ |
||
207 | void ResetDevice(void); |
||
208 | |||
209 | /********************************************************************* |
||
210 | * Macros: GetMaxX() |
||
211 | * |
||
212 | * Overview: Returns maximum horizontal coordinate. |
||
213 | * |
||
214 | * PreCondition: none |
||
215 | * |
||
216 | * Input: none |
||
217 | * |
||
218 | * Output: Maximum horizontal coordinate. |
||
219 | * |
||
220 | * Example: |
||
221 | * <CODE> |
||
222 | * |
||
223 | * // Create a window that will occupy the whole screen. |
||
224 | * WndCreate(0xFF, // ID |
||
225 | * 0,0, |
||
226 | * GetMaxX(),GetMaxY(), // dimension |
||
227 | * WND_DRAW, // will be dislayed after creation |
||
228 | * (void*)&mchpIcon, // use icon used |
||
229 | * pText, // set to text pointed to by pText |
||
230 | * NULL); // use default scheme |
||
231 | * |
||
232 | * </CODE> |
||
233 | * |
||
234 | * Side Effects: none |
||
235 | * |
||
236 | ********************************************************************/ |
||
237 | #if (DISP_ORIENTATION == 90) |
||
238 | #define GetMaxX() (DISP_VER_RESOLUTION - 1) |
||
239 | #elif (DISP_ORIENTATION == 0) |
||
240 | #define GetMaxX() (DISP_HOR_RESOLUTION - 1) |
||
241 | #endif |
||
242 | |||
243 | /********************************************************************* |
||
244 | * Macros: GetMaxY() |
||
245 | * |
||
246 | * Overview: Returns maximum vertical coordinate. |
||
247 | * |
||
248 | * PreCondition: none |
||
249 | * |
||
250 | * Input: none |
||
251 | * |
||
252 | * Output: Maximum vertical coordinate. |
||
253 | * |
||
254 | * Example: (see GetMaxX()) example. |
||
255 | * |
||
256 | * Side Effects: none |
||
257 | * |
||
258 | ********************************************************************/ |
||
259 | #if (DISP_ORIENTATION == 90) |
||
260 | #define GetMaxY() (DISP_HOR_RESOLUTION - 1) |
||
261 | #elif (DISP_ORIENTATION == 0) |
||
262 | #define GetMaxY() (DISP_VER_RESOLUTION - 1) |
||
263 | #endif |
||
264 | |||
265 | /********************************************************************* |
||
266 | * Macros: SetColor(color) |
||
267 | * |
||
268 | * Overview: Sets current drawing color. |
||
269 | * |
||
270 | * PreCondition: none |
||
271 | * |
||
272 | * Input: color - Color coded in 5:6:5 RGB format. |
||
273 | * |
||
274 | * Output: none |
||
275 | * |
||
276 | * Side Effects: none |
||
277 | * |
||
278 | ********************************************************************/ |
||
279 | #define SetColor(color) _color = color; |
||
280 | |||
281 | /********************************************************************* |
||
282 | * Macros: GetColor() |
||
283 | * |
||
284 | * Overview: Returns current drawing color. |
||
285 | * |
||
286 | * PreCondition: none |
||
287 | * |
||
288 | * Input: none |
||
289 | * |
||
290 | * Output: Color coded in 5:6:5 RGB format. |
||
291 | * |
||
292 | * Side Effects: none |
||
293 | * |
||
294 | ********************************************************************/ |
||
295 | #define GetColor() _color |
||
296 | |||
297 | /********************************************************************* |
||
298 | * Macros: SetActivePage(page) |
||
299 | * |
||
300 | * Overview: Sets active graphic page. |
||
301 | * |
||
302 | * PreCondition: none |
||
303 | * |
||
304 | * Input: page - Graphic page number. |
||
305 | * |
||
306 | * Output: none |
||
307 | * |
||
308 | * Side Effects: none |
||
309 | * |
||
310 | ********************************************************************/ |
||
311 | #define SetActivePage(page) |
||
312 | |||
313 | /********************************************************************* |
||
314 | * Macros: SetVisualPage(page) |
||
315 | * |
||
316 | * Overview: Sets graphic page to display. |
||
317 | * |
||
318 | * PreCondition: none |
||
319 | * |
||
320 | * Input: page - Graphic page number |
||
321 | * |
||
322 | * Output: none |
||
323 | * |
||
324 | * Side Effects: none |
||
325 | * |
||
326 | ********************************************************************/ |
||
327 | #define SetVisualPage(page) |
||
328 | |||
329 | /********************************************************************* |
||
330 | * Function: void PutPixel(SHORT x, SHORT y) |
||
331 | * |
||
332 | * Overview: Puts pixel with the given x,y coordinate position. |
||
333 | * |
||
334 | * PreCondition: none |
||
335 | * |
||
336 | * Input: x - x position of the pixel. |
||
337 | * y - y position of the pixel. |
||
338 | * |
||
339 | * Output: none |
||
340 | * |
||
341 | * Side Effects: none |
||
342 | * |
||
343 | ********************************************************************/ |
||
344 | void PutPixel(SHORT x, SHORT y); |
||
345 | |||
346 | /********************************************************************* |
||
347 | * Function: WORD GetPixel(SHORT x, SHORT y) |
||
348 | * |
||
349 | * Overview: Returns pixel color at the given x,y coordinate position. |
||
350 | * |
||
351 | * PreCondition: none |
||
352 | * |
||
353 | * Input: x - x position of the pixel. |
||
354 | * y - y position of the pixel. |
||
355 | * |
||
356 | * Output: pixel color |
||
357 | * |
||
358 | * Side Effects: none |
||
359 | * |
||
360 | ********************************************************************/ |
||
361 | WORD GetPixel(SHORT x, SHORT y); |
||
362 | |||
363 | /********************************************************************* |
||
364 | * Macros: SetClipRgn(left, top, right, bottom) |
||
365 | * |
||
366 | * Overview: Sets clipping region. |
||
367 | * |
||
368 | * PreCondition: none |
||
369 | * |
||
370 | * Input: left - Defines the left clipping region border. |
||
371 | * top - Defines the top clipping region border. |
||
372 | * right - Defines the right clipping region border. |
||
373 | * bottom - Defines the bottom clipping region border. |
||
374 | * |
||
375 | * Output: none |
||
376 | * |
||
377 | * Side Effects: none |
||
378 | * |
||
379 | ********************************************************************/ |
||
380 | #define SetClipRgn(left, top, right, bottom) \ |
||
381 | _clipLeft = left; \ |
||
382 | _clipTop = top; \ |
||
383 | _clipRight = right; \ |
||
384 | _clipBottom = bottom; |
||
385 | |||
386 | /********************************************************************* |
||
387 | * Macros: GetClipLeft() |
||
388 | * |
||
389 | * Overview: Returns left clipping border. |
||
390 | * |
||
391 | * PreCondition: none |
||
392 | * |
||
393 | * Input: none |
||
394 | * |
||
395 | * Output: Left clipping border. |
||
396 | * |
||
397 | * Side Effects: none |
||
398 | * |
||
399 | ********************************************************************/ |
||
400 | #define GetClipLeft() _clipLeft |
||
401 | |||
402 | /********************************************************************* |
||
403 | * Macros: GetClipRight() |
||
404 | * |
||
405 | * Overview: Returns right clipping border. |
||
406 | * |
||
407 | * PreCondition: none |
||
408 | * |
||
409 | * Input: none |
||
410 | * |
||
411 | * Output: Right clipping border. |
||
412 | * |
||
413 | * Side Effects: none |
||
414 | * |
||
415 | ********************************************************************/ |
||
416 | #define GetClipRight() _clipRight |
||
417 | |||
418 | /********************************************************************* |
||
419 | * Macros: GetClipTop() |
||
420 | * |
||
421 | * Overview: Returns top clipping border. |
||
422 | * |
||
423 | * PreCondition: none |
||
424 | * |
||
425 | * Input: none |
||
426 | * |
||
427 | * Output: Top clipping border. |
||
428 | * |
||
429 | * Side Effects: none |
||
430 | * |
||
431 | ********************************************************************/ |
||
432 | #define GetClipTop() _clipTop |
||
433 | |||
434 | /********************************************************************* |
||
435 | * Macros: GetClipBottom() |
||
436 | * |
||
437 | * Overview: Returns bottom clipping border. |
||
438 | * |
||
439 | * PreCondition: none |
||
440 | * |
||
441 | * Input: none |
||
442 | * |
||
443 | * Output: Bottom clipping border. |
||
444 | * |
||
445 | * Side Effects: none |
||
446 | * |
||
447 | ********************************************************************/ |
||
448 | #define GetClipBottom() _clipBottom |
||
449 | |||
450 | /********************************************************************* |
||
451 | * Macros: SetClip(control) |
||
452 | * |
||
453 | * Overview: Enables/disables clipping. |
||
454 | * |
||
455 | * PreCondition: none |
||
456 | * |
||
457 | * Input: control - Enables or disables the clipping. |
||
458 | * - 0: Disable clipping |
||
459 | * - 1: Enable clipping |
||
460 | * |
||
461 | * Output: none |
||
462 | * |
||
463 | * Side Effects: none |
||
464 | * |
||
465 | ********************************************************************/ |
||
466 | #define SetClip(control) _clipRgn = control; |
||
467 | |||
468 | /********************************************************************* |
||
469 | * Macros: IsDeviceBusy() |
||
470 | * |
||
471 | * Overview: Returns non-zero if LCD controller is busy |
||
472 | * (previous drawing operation is not completed). |
||
473 | * |
||
474 | * PreCondition: none |
||
475 | * |
||
476 | * Input: none |
||
477 | * |
||
478 | * Output: Busy status. |
||
479 | * |
||
480 | * Side Effects: none |
||
481 | * |
||
482 | ********************************************************************/ |
||
483 | #define IsDeviceBusy() 0 |
||
484 | |||
485 | /********************************************************************* |
||
486 | * Macros: SetPalette(colorNum, color) |
||
487 | * |
||
488 | * Overview: Sets palette register. |
||
489 | * |
||
490 | * PreCondition: none |
||
491 | * |
||
492 | * Input: colorNum - Register number. |
||
493 | * color - Color. |
||
494 | * |
||
495 | * Output: none |
||
496 | * |
||
497 | * Side Effects: none |
||
498 | * |
||
499 | ********************************************************************/ |
||
500 | #define SetPalette(colorNum, color) |
||
501 | |||
502 | #endif // _DRVTFT001_H |
Powered by WebSVN v2.8.3