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