Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /***************************************************************************** |
2 | * Module for Microchip Graphics Library |
||
3 | * ST7529 LCD controllers driver |
||
4 | ***************************************************************************** |
||
5 | * FileName: ST7529.h |
||
6 | * Dependencies: p24Fxxxx.h |
||
7 | * Processor: PIC24 |
||
8 | * Compiler: MPLAB C30 |
||
9 | * Linker: MPLAB LINK30 |
||
10 | * Company: Microchip Technology Incorporated |
||
11 | * |
||
12 | * Software License Agreement |
||
13 | * |
||
14 | * Copyright © 2008 Microchip Technology Inc. All rights reserved. |
||
15 | * Microchip licenses to you the right to use, modify, copy and distribute |
||
16 | * Software only when embedded on a Microchip microcontroller or digital |
||
17 | * signal controller, which is integrated into your product or third party |
||
18 | * product (pursuant to the sublicense terms in the accompanying license |
||
19 | * agreement). |
||
20 | * |
||
21 | * You should refer to the license agreement accompanying this Software |
||
22 | * for additional information regarding your rights and obligations. |
||
23 | * |
||
24 | * SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY |
||
25 | * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY |
||
26 | * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR |
||
27 | * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR |
||
28 | * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, |
||
29 | * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT |
||
30 | * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, |
||
31 | * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, |
||
32 | * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY |
||
33 | * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), |
||
34 | * OR OTHER SIMILAR COSTS. |
||
35 | * |
||
36 | * Author Date Comment |
||
37 | *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
38 | * Anton Alkhimenok 03/20/08 |
||
39 | *****************************************************************************/ |
||
40 | #ifndef _ST7529_H |
||
41 | #define _ST7529_H |
||
42 | |||
43 | #ifdef __PIC32MX |
||
44 | #include <plib.h> |
||
45 | #define PMDIN1 PMDIN |
||
46 | #else |
||
47 | #ifdef __PIC24F__ |
||
48 | #include <p24Fxxxx.h> |
||
49 | #else |
||
50 | #error CONTROLLER IS NOT SUPPORTED |
||
51 | #endif |
||
52 | #endif |
||
53 | #include "GraphicsConfig.h" |
||
54 | #include "GenericTypeDefs.h" |
||
55 | |||
56 | /********************************************************************* |
||
57 | * Overview: Additional hardware-accelerated functions can be implemented |
||
58 | * in the driver. These definitions exclude the PutPixel()-based |
||
59 | * functions in the primitives layer (Primitive.c file) from compilation. |
||
60 | *********************************************************************/ |
||
61 | |||
62 | // Define this to implement Font related functions in the driver. |
||
63 | //#define USE_DRV_FONT |
||
64 | // Define this to implement Line function in the driver. |
||
65 | //#define USE_DRV_LINE |
||
66 | // Define this to implement Circle function in the driver. |
||
67 | //#define USE_DRV_CIRCLE |
||
68 | // Define this to implement FillCircle function in the driver. |
||
69 | //#define USE_DRV_FILLCIRCLE |
||
70 | // Define this to implement Bar function in the driver. |
||
71 | //#define USE_DRV_BAR |
||
72 | // Define this to implement ClearDevice function in the driver. |
||
73 | #define USE_DRV_CLEARDEVICE |
||
74 | |||
75 | // Define this to implement PutImage function in the driver. |
||
76 | // #define USE_DRV_PUTIMAGE |
||
77 | |||
78 | #ifdef USE_16BIT_PMP |
||
79 | #error This driver doesn't support 16-bit PMP (remove USE_16BIT_PMP option from GHardwareProfile.h) |
||
80 | #endif |
||
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 (DISP_HOR_RESOLUTION != 256) |
||
98 | #error This driver doesn't supports this resolution. Horizontal resolution must be 256 pixels. |
||
99 | #endif |
||
100 | #if (DISP_VER_RESOLUTION != 128) |
||
101 | #error This driver doesn't supports this resolution. Vertical resolution must be 128 pixels. |
||
102 | #endif |
||
103 | |||
104 | /********************************************************************* |
||
105 | * Overview: Display orientation. |
||
106 | *********************************************************************/ |
||
107 | #if (DISP_ORIENTATION != 0) && (DISP_ORIENTATION != 180) |
||
108 | #error This driver doesn't support this orientation. |
||
109 | #endif |
||
110 | |||
111 | /********************************************************************* |
||
112 | * Overview: Color depth. |
||
113 | *********************************************************************/ |
||
114 | #if (COLOR_DEPTH != 5) |
||
115 | #error This driver doesn't support this color depth. It should be 5. |
||
116 | #endif |
||
117 | |||
118 | // Norm commands |
||
119 | #define EXTIN 0x30 |
||
120 | #define EXTOUT 0x31 |
||
121 | #define DISON 0xaf |
||
122 | #define DISOFF 0xae |
||
123 | #define DISNOR 0xa6 |
||
124 | #define DISINV 0xa7 |
||
125 | #define COMSCN 0xbb |
||
126 | #define DISCTRL 0xca |
||
127 | #define SLPIN 0x95 |
||
128 | #define SLPOUT 0x94 |
||
129 | #define LASET 0x75 |
||
130 | #define CASET 0x15 |
||
131 | #define DATSDR 0xbc |
||
132 | #define RAMWR 0x5c |
||
133 | #define RAMRD 0x5d |
||
134 | #define PTLIN 0xa8 |
||
135 | #define PTLOUT 0xa9 |
||
136 | #define RMWIN 0xe0 |
||
137 | #define RMWOUT 0xee |
||
138 | #define ASCSET 0xaa |
||
139 | #define SCSTART 0xab |
||
140 | #define OSCON 0xd1 |
||
141 | #define OSCOFF 0xd2 |
||
142 | #define PWRCTRL 0x20 |
||
143 | #define VOLCTRL 0x81 |
||
144 | #define VOLUP 0xd6 |
||
145 | #define VOLDOWN 0xd7 |
||
146 | #define EPSRRD1 0x7c |
||
147 | #define EPSRRD2 0x7d |
||
148 | #define NOP 0x25 |
||
149 | #define EPINT 0x07 |
||
150 | |||
151 | // Ext commands |
||
152 | #define GRAY1SET 0x20 |
||
153 | #define GRAY2SET 0x21 |
||
154 | #define ANASET 0x32 |
||
155 | #define SWINT 0x34 |
||
156 | #define EPCTIN 0xcd |
||
157 | #define EPCOUT 0xcc |
||
158 | #define EPMWR 0xfc |
||
159 | #define EPMRD 0xfd |
||
160 | |||
161 | /********************************************************************* |
||
162 | * Overview: Clipping region control codes to be used with SetClip(...) |
||
163 | * function. |
||
164 | *********************************************************************/ |
||
165 | #define CLIP_DISABLE 0 // Disables clipping. |
||
166 | #define CLIP_ENABLE 1 // Enables clipping. |
||
167 | |||
168 | /********************************************************************* |
||
169 | * Overview: Some basic colors definitions. |
||
170 | *********************************************************************/ |
||
171 | #define BLACK 0 |
||
172 | #define GRAY1 (2 << 3) |
||
173 | #define GRAY2 (4 << 3) |
||
174 | #define GRAY3 (6 << 3) |
||
175 | #define GRAY4 (8 << 3) |
||
176 | #define GRAY5 (10 << 3) |
||
177 | #define GRAY6 (12 << 3) |
||
178 | #define GRAY7 (14 << 3) |
||
179 | #define GRAY8 (16 << 3) |
||
180 | #define GRAY9 (18 << 3) |
||
181 | #define GRAY10 (20 << 3) |
||
182 | #define GRAY11 (22 << 3) |
||
183 | #define GRAY12 (24 << 3) |
||
184 | #define GRAY13 (26 << 3) |
||
185 | #define GRAY14 (28 << 3) |
||
186 | #define GRAY15 (30 << 3) |
||
187 | #define WHITE (31 << 3) |
||
188 | |||
189 | // Color |
||
190 | extern BYTE _color; |
||
191 | |||
192 | /********************************************************************* |
||
193 | * Overview: Clipping region control and border settings. |
||
194 | * |
||
195 | *********************************************************************/ |
||
196 | |||
197 | // Clipping region enable control |
||
198 | extern SHORT _clipRgn; |
||
199 | |||
200 | // Left clipping region border |
||
201 | extern SHORT _clipLeft; |
||
202 | |||
203 | // Top clipping region border |
||
204 | extern SHORT _clipTop; |
||
205 | |||
206 | // Right clipping region border |
||
207 | extern SHORT _clipRight; |
||
208 | |||
209 | // Bottom clipping region border |
||
210 | extern SHORT _clipBottom; |
||
211 | |||
212 | / |
||
213 | /********************************************************************* |
||
214 | * Function: void ResetDevice() |
||
215 | * |
||
216 | * Overview: Initializes LCD module. |
||
217 | * |
||
218 | * PreCondition: none |
||
219 | * |
||
220 | * Input: none |
||
221 | * |
||
222 | * Output: none |
||
223 | * |
||
224 | * Side Effects: none |
||
225 | * |
||
226 | ********************************************************************/ |
||
227 | void ResetDevice(void); |
||
228 | |||
229 | /********************************************************************* |
||
230 | * Macros: GetMaxX() |
||
231 | * |
||
232 | * Overview: Returns maximum horizontal coordinate. |
||
233 | * |
||
234 | * PreCondition: none |
||
235 | * |
||
236 | * Input: none |
||
237 | * |
||
238 | * Output: Maximum horizontal coordinate. |
||
239 | * |
||
240 | * Side Effects: none |
||
241 | * |
||
242 | ********************************************************************/ |
||
243 | #define GetMaxX() (DISP_HOR_RESOLUTION - 1) |
||
244 | |||
245 | /********************************************************************* |
||
246 | * Macros: GetMaxY() |
||
247 | * |
||
248 | * Overview: Returns maximum vertical coordinate. |
||
249 | * |
||
250 | * PreCondition: none |
||
251 | * |
||
252 | * Input: none |
||
253 | * |
||
254 | * Output: Maximum vertical coordinate. |
||
255 | * |
||
256 | * Side Effects: none |
||
257 | * |
||
258 | ********************************************************************/ |
||
259 | #define GetMaxY() (DISP_VER_RESOLUTION - 1) |
||
260 | |||
261 | /********************************************************************* |
||
262 | * Macros: SetColor(color) |
||
263 | * |
||
264 | * Overview: Sets current drawing color. |
||
265 | * |
||
266 | * PreCondition: none |
||
267 | * |
||
268 | * Input: color - Color coded in 5:6:5 RGB format. |
||
269 | * |
||
270 | * Output: none |
||
271 | * |
||
272 | * Side Effects: none |
||
273 | * |
||
274 | ********************************************************************/ |
||
275 | #define SetColor(color) _color = (BYTE) color; |
||
276 | |||
277 | /********************************************************************* |
||
278 | * Macros: GetColor() |
||
279 | * |
||
280 | * Overview: Returns current drawing color. |
||
281 | * |
||
282 | * PreCondition: none |
||
283 | * |
||
284 | * Input: none |
||
285 | * |
||
286 | * Output: Color coded in 5:6:5 RGB format. |
||
287 | * |
||
288 | * Side Effects: none |
||
289 | * |
||
290 | ********************************************************************/ |
||
291 | #define GetColor() _color |
||
292 | |||
293 | /********************************************************************* |
||
294 | * Macros: SetActivePage(page) |
||
295 | * |
||
296 | * Overview: Sets active graphic page. |
||
297 | * |
||
298 | * PreCondition: none |
||
299 | * |
||
300 | * Input: page - Graphic page number. |
||
301 | * |
||
302 | * Output: none |
||
303 | * |
||
304 | * Side Effects: none |
||
305 | * |
||
306 | ********************************************************************/ |
||
307 | #define SetActivePage(page) |
||
308 | |||
309 | /********************************************************************* |
||
310 | * Macros: SetVisualPage(page) |
||
311 | * |
||
312 | * Overview: Sets graphic page to display. |
||
313 | * |
||
314 | * PreCondition: none |
||
315 | * |
||
316 | * Input: page - Graphic page number |
||
317 | * |
||
318 | * Output: none |
||
319 | * |
||
320 | * Side Effects: none |
||
321 | * |
||
322 | ********************************************************************/ |
||
323 | #define SetVisualPage(page) |
||
324 | |||
325 | /********************************************************************* |
||
326 | * Function: void PutPixel(SHORT x, SHORT y) |
||
327 | * |
||
328 | * Overview: Puts pixel with the given x,y coordinate position. |
||
329 | * |
||
330 | * PreCondition: none |
||
331 | * |
||
332 | * Input: x - x position of the pixel. |
||
333 | * y - y position of the pixel. |
||
334 | * |
||
335 | * Output: none |
||
336 | * |
||
337 | * Side Effects: none |
||
338 | * |
||
339 | ********************************************************************/ |
||
340 | void PutPixel(SHORT x, SHORT y); |
||
341 | |||
342 | /********************************************************************* |
||
343 | * Function: WORD GetPixel(SHORT x, SHORT y) |
||
344 | * |
||
345 | * Overview: Returns pixel color at the given x,y coordinate position. |
||
346 | * |
||
347 | * PreCondition: none |
||
348 | * |
||
349 | * Input: x - x position of the pixel. |
||
350 | * y - y position of the pixel. |
||
351 | * |
||
352 | * Output: pixel color |
||
353 | * |
||
354 | * Side Effects: none |
||
355 | * |
||
356 | ********************************************************************/ |
||
357 | WORD GetPixel(SHORT x, SHORT y); |
||
358 | |||
359 | /********************************************************************* |
||
360 | * Macros: SetClipRgn(left, top, right, bottom) |
||
361 | * |
||
362 | * Overview: Sets clipping region. |
||
363 | * |
||
364 | * PreCondition: none |
||
365 | * |
||
366 | * Input: left - Defines the left clipping region border. |
||
367 | * top - Defines the top clipping region border. |
||
368 | * right - Defines the right clipping region border. |
||
369 | * bottom - Defines the bottom clipping region border. |
||
370 | * |
||
371 | * Output: none |
||
372 | * |
||
373 | * Side Effects: none |
||
374 | * |
||
375 | ********************************************************************/ |
||
376 | #define SetClipRgn(left, top, right, bottom) \ |
||
377 | _clipLeft = left; \ |
||
378 | _clipTop = top; \ |
||
379 | _clipRight = right; \ |
||
380 | _clipBottom = bottom; |
||
381 | |||
382 | /********************************************************************* |
||
383 | * Macros: GetClipLeft() |
||
384 | * |
||
385 | * Overview: Returns left clipping border. |
||
386 | * |
||
387 | * PreCondition: none |
||
388 | * |
||
389 | * Input: none |
||
390 | * |
||
391 | * Output: Left clipping border. |
||
392 | * |
||
393 | * Side Effects: none |
||
394 | * |
||
395 | ********************************************************************/ |
||
396 | #define GetClipLeft() _clipLeft |
||
397 | |||
398 | /********************************************************************* |
||
399 | * Macros: GetClipRight() |
||
400 | * |
||
401 | * Overview: Returns right clipping border. |
||
402 | * |
||
403 | * PreCondition: none |
||
404 | * |
||
405 | * Input: none |
||
406 | * |
||
407 | * Output: Right clipping border. |
||
408 | * |
||
409 | * Side Effects: none |
||
410 | * |
||
411 | ********************************************************************/ |
||
412 | #define GetClipRight() _clipRight |
||
413 | |||
414 | /********************************************************************* |
||
415 | * Macros: GetClipTop() |
||
416 | * |
||
417 | * Overview: Returns top clipping border. |
||
418 | * |
||
419 | * PreCondition: none |
||
420 | * |
||
421 | * Input: none |
||
422 | * |
||
423 | * Output: Top clipping border. |
||
424 | * |
||
425 | * Side Effects: none |
||
426 | * |
||
427 | ********************************************************************/ |
||
428 | #define GetClipTop() _clipTop |
||
429 | |||
430 | /********************************************************************* |
||
431 | * Macros: GetClipBottom() |
||
432 | * |
||
433 | * Overview: Returns bottom clipping border. |
||
434 | * |
||
435 | * PreCondition: none |
||
436 | * |
||
437 | * Input: none |
||
438 | * |
||
439 | * Output: Bottom clipping border. |
||
440 | * |
||
441 | * Side Effects: none |
||
442 | * |
||
443 | ********************************************************************/ |
||
444 | #define GetClipBottom() _clipBottom |
||
445 | |||
446 | /********************************************************************* |
||
447 | * Macros: SetClip(control) |
||
448 | * |
||
449 | * Overview: Enables/disables clipping. |
||
450 | * |
||
451 | * PreCondition: none |
||
452 | * |
||
453 | * Input: control - Enables or disables the clipping. |
||
454 | * - 0: Disable clipping |
||
455 | * - 1: Enable clipping |
||
456 | * |
||
457 | * Output: none |
||
458 | * |
||
459 | * Side Effects: none |
||
460 | * |
||
461 | ********************************************************************/ |
||
462 | #define SetClip(control) _clipRgn = control; |
||
463 | |||
464 | /********************************************************************* |
||
465 | * Macros: IsDeviceBusy() |
||
466 | * |
||
467 | * Overview: Returns non-zero if LCD controller is busy |
||
468 | * (previous drawing operation is not completed). |
||
469 | * |
||
470 | * PreCondition: none |
||
471 | * |
||
472 | * Input: none |
||
473 | * |
||
474 | * Output: Busy status. |
||
475 | * |
||
476 | * Side Effects: none |
||
477 | * |
||
478 | ********************************************************************/ |
||
479 | #define IsDeviceBusy() 0 |
||
480 | |||
481 | /********************************************************************* |
||
482 | * Macros: SetPalette(colorNum, color) |
||
483 | * |
||
484 | * Overview: Sets palette register. |
||
485 | * |
||
486 | * PreCondition: none |
||
487 | * |
||
488 | * Input: colorNum - Register number. |
||
489 | * color - Color. |
||
490 | * |
||
491 | * Output: none |
||
492 | * |
||
493 | * Side Effects: none |
||
494 | * |
||
495 | ********************************************************************/ |
||
496 | #define SetPalette(colorNum, color) |
||
497 | |||
498 | /********************************************************************* |
||
499 | * Function: void ContrastSet(WORD contrast) |
||
500 | * |
||
501 | * PreCondition: none |
||
502 | * |
||
503 | * Input: contrast value (LSB 10-0 are valid, MSB 15-11 are not used) |
||
504 | * |
||
505 | * Output: none |
||
506 | * |
||
507 | * Side Effects: none |
||
508 | * |
||
509 | * Overview: sets contrast |
||
510 | * |
||
511 | * Note: none |
||
512 | * |
||
513 | ********************************************************************/ |
||
514 | void ContrastSet(WORD contrast); |
||
515 | |||
516 | /********************************************************************* |
||
517 | * Function: void ContrastUp(void) |
||
518 | * |
||
519 | * PreCondition: none |
||
520 | * |
||
521 | * Input: none |
||
522 | * |
||
523 | * Output: none |
||
524 | * |
||
525 | * Side Effects: none |
||
526 | * |
||
527 | * Overview: increases contrast |
||
528 | * |
||
529 | * Note: none |
||
530 | * |
||
531 | ********************************************************************/ |
||
532 | void ContrastUp(void); |
||
533 | |||
534 | /********************************************************************* |
||
535 | * Function: void ContrastDown(void) |
||
536 | * |
||
537 | * PreCondition: none |
||
538 | * |
||
539 | * Input: none |
||
540 | * |
||
541 | * Output: none |
||
542 | * |
||
543 | * Side Effects: none |
||
544 | * |
||
545 | * Overview: decreases contrast |
||
546 | * |
||
547 | * Note: none |
||
548 | * |
||
549 | ********************************************************************/ |
||
550 | void ContrastDown(void); |
||
551 | |||
552 | /********************************************************************* |
||
553 | * Function: void DisplayOn(void) |
||
554 | * |
||
555 | * PreCondition: none |
||
556 | * |
||
557 | * Input: none |
||
558 | * |
||
559 | * Output: none |
||
560 | * |
||
561 | * Side Effects: none |
||
562 | * |
||
563 | * Overview: turns on display |
||
564 | * |
||
565 | * Note: none |
||
566 | * |
||
567 | ********************************************************************/ |
||
568 | void DisplayOn(void); |
||
569 | |||
570 | /********************************************************************* |
||
571 | * Function: void DisplayOn(void) |
||
572 | * |
||
573 | * PreCondition: none |
||
574 | * |
||
575 | * Input: none |
||
576 | * |
||
577 | * Output: none |
||
578 | * |
||
579 | * Side Effects: none |
||
580 | * |
||
581 | * Overview: turns off display |
||
582 | * |
||
583 | * Note: none |
||
584 | * |
||
585 | ********************************************************************/ |
||
586 | void DisplayOff(void); |
||
587 | |||
588 | /********************************************************************* |
||
589 | * Function: void SleepIn(void) |
||
590 | * |
||
591 | * PreCondition: none |
||
592 | * |
||
593 | * Input: none |
||
594 | * |
||
595 | * Output: none |
||
596 | * |
||
597 | * Side Effects: none |
||
598 | * |
||
599 | * Overview: enters sleep mode |
||
600 | * |
||
601 | * Note: none |
||
602 | * |
||
603 | ********************************************************************/ |
||
604 | void SleepIn(void); |
||
605 | |||
606 | /********************************************************************* |
||
607 | * Function: void WakeUp(void) |
||
608 | * |
||
609 | * PreCondition: none |
||
610 | * |
||
611 | * Input: none |
||
612 | * |
||
613 | * Output: none |
||
614 | * |
||
615 | * Side Effects: none |
||
616 | * |
||
617 | * Overview: wakes up from sleep |
||
618 | * |
||
619 | * Note: none |
||
620 | * |
||
621 | ********************************************************************/ |
||
622 | void WakeUp(void); |
||
623 | #endif // _ST7529_H |
Powered by WebSVN v2.8.3