Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /***************************************************************************** |
2 | * Module for Microchip Graphics Library |
||
3 | * UltraChip UC1610 LCD controllers driver |
||
4 | ***************************************************************************** |
||
5 | * FileName: UC1610.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 © 2009 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 02/25/09 |
||
39 | *****************************************************************************/ |
||
40 | #ifndef _UC1610_H |
||
41 | #define _UC1610_H |
||
42 | |||
43 | #include <p24Fxxxx.h> |
||
44 | |||
45 | #include "GraphicsConfig.h" |
||
46 | #include "GenericTypeDefs.h" |
||
47 | |||
48 | /********************************************************************* |
||
49 | * Overview: Additional hardware-accelerated functions can be implemented |
||
50 | * in the driver. These definitions exclude the PutPixel()-based |
||
51 | * functions in the primitives layer (Primitive.c file) from compilation. |
||
52 | *********************************************************************/ |
||
53 | |||
54 | // Define this to implement Font related functions in the driver. |
||
55 | //#define USE_DRV_FONT |
||
56 | // Define this to implement Line function in the driver. |
||
57 | //#define USE_DRV_LINE |
||
58 | // Define this to implement Circle function in the driver. |
||
59 | //#define USE_DRV_CIRCLE |
||
60 | // Define this to implement FillCircle function in the driver. |
||
61 | //#define USE_DRV_FILLCIRCLE |
||
62 | // Define this to implement Bar function in the driver. |
||
63 | //#define USE_DRV_BAR |
||
64 | // Define this to implement ClearDevice function in the driver. |
||
65 | #define USE_DRV_CLEARDEVICE |
||
66 | |||
67 | // Define this to implement PutImage function in the driver. |
||
68 | #define USE_DRV_PUTIMAGE |
||
69 | |||
70 | #ifdef USE_16BIT_PMP |
||
71 | #error This driver doesn't support 16-bit PMP (remove USE_16BIT_PMP option from HardwareProfile.h) |
||
72 | #endif |
||
73 | #ifndef DISP_HOR_RESOLUTION |
||
74 | #error DISP_HOR_RESOLUTION must be defined in HardwareProfile.h |
||
75 | #endif |
||
76 | #ifndef DISP_VER_RESOLUTION |
||
77 | #error DISP_VER_RESOLUTION must be defined in HardwareProfile.h |
||
78 | #endif |
||
79 | #ifndef COLOR_DEPTH |
||
80 | #error COLOR_DEPTH must be defined in HardwareProfile.h |
||
81 | #endif |
||
82 | #ifndef DISP_ORIENTATION |
||
83 | #error DISP_ORIENTATION must be defined in HardwareProfile.h |
||
84 | #endif |
||
85 | |||
86 | /********************************************************************* |
||
87 | * Overview: Horizontal and vertical screen size. |
||
88 | *********************************************************************/ |
||
89 | #if (DISP_HOR_RESOLUTION != 160) |
||
90 | #error This driver doesn't supports this resolution. Horizontal resolution must be 160 pixels. |
||
91 | #endif |
||
92 | #if (DISP_VER_RESOLUTION != 100) |
||
93 | #error This driver doesn't supports this resolution. Vertical resolution must be 100 pixels. |
||
94 | #endif |
||
95 | |||
96 | /********************************************************************* |
||
97 | * Overview: Display orientation. |
||
98 | *********************************************************************/ |
||
99 | #if (DISP_ORIENTATION != 0) |
||
100 | #error This driver doesn't support this orientation. It must be 0. |
||
101 | #endif |
||
102 | |||
103 | /********************************************************************* |
||
104 | * Overview: Color depth. |
||
105 | *********************************************************************/ |
||
106 | #if (COLOR_DEPTH != 2) |
||
107 | #error This driver doesn't support this color depth. It should be 2. |
||
108 | #endif |
||
109 | #define CMD_DISPLAY_ON 0 b10101111 |
||
110 | #define CMD_DISPLAY_OFF 0 b10101110 |
||
111 | |||
112 | #define CMD_INVERSE_ON 0 b10100111 |
||
113 | #define CMD_INVERSE_OFF 0 b10100110 |
||
114 | |||
115 | #define CMD_PANEL_LOADING_16NF 0 b00101000 |
||
116 | #define CMD_PANEL_LOADING_21NF 0 b00101001 |
||
117 | #define CMD_PANEL_LOADING_28NF 0 b00101010 |
||
118 | #define CMD_PANEL_LOADING_38NF 0 b00101011 |
||
119 | |||
120 | #define CMD_LINE_RATE_12KLPS 0 b10100000 |
||
121 | #define CMD_LINE_RATE_13KLPS 0 b10100001 |
||
122 | #define CMD_LINE_RATE_14KLPS 0 b10100010 |
||
123 | #define CMD_LINE_RATE_16KLPS 0 b10100011 |
||
124 | |||
125 | #define CMD_DISPLAY_START 0 b11110010 |
||
126 | #define CMD_DISPLAY_END 0 b11110011 |
||
127 | #define CMD_COM_END 0 b11110001 |
||
128 | |||
129 | #define CMD_BIAS_RATIO_5 0 b11101000 |
||
130 | #define CMD_BIAS_RATIO_10 0 b11101001 |
||
131 | #define CMD_BIAS_RATIO_11 0 b11101010 |
||
132 | #define CMD_BIAS_RATIO_12 0 b11101011 |
||
133 | |||
134 | #define CMD_CONTRAST 0 b10000001 |
||
135 | |||
136 | #define CMD_RAM_ADDR_INCR_OFF 0 b10001000 |
||
137 | #define CMD_RAM_ADDR_INCR_ON 0 b10001101 |
||
138 | |||
139 | #define CMD_MAPPING_CTRL 0 b11000000 |
||
140 | #define CMD_MAPPING_MY 0 b11000100 |
||
141 | #define CMD_MAPPING_MX 0 b11000010 |
||
142 | |||
143 | #define CMD_WND_PRG_DISABLE 0 b11111000 |
||
144 | #define CMD_WND_PRG_ENABLE 0 b11111001 |
||
145 | #define CMD_START_COLUMN 0 b11110100 |
||
146 | #define CMD_START_PAGE 0 b11110101 |
||
147 | #define CMD_END_COLUMN 0 b11110110 |
||
148 | #define CMD_END_PAGE 0 b11110111 |
||
149 | |||
150 | #define CMD_COLUMN_ADDR_LSB 0 b00000000 |
||
151 | #define CMD_COLUMN_ADDR_MSB 0 b00010000 |
||
152 | #define CMD_PAGE_ADDR 0 b01100000 |
||
153 | |||
154 | #define DISP_START_COLUMN 0 |
||
155 | #define DISP_START_PAGE 7 |
||
156 | #define DISP_END_COLUMN 159 |
||
157 | #define DISP_END_PAGE 31 |
||
158 | |||
159 | /********************************************************************* |
||
160 | * Overview: Clipping region control codes to be used with SetClip(...) |
||
161 | * function. |
||
162 | *********************************************************************/ |
||
163 | #define CLIP_DISABLE 0 // Disables clipping. |
||
164 | #define CLIP_ENABLE 1 // Enables clipping. |
||
165 | |||
166 | /********************************************************************* |
||
167 | * Overview: Some basic colors definitions. |
||
168 | *********************************************************************/ |
||
169 | #define BLACK 0 |
||
170 | #define GRAY1 1 |
||
171 | #define GRAY0 2 |
||
172 | #define WHITE 3 |
||
173 | |||
174 | // Color |
||
175 | extern BYTE _color; |
||
176 | |||
177 | /********************************************************************* |
||
178 | * Overview: Clipping region control and border settings. |
||
179 | * |
||
180 | *********************************************************************/ |
||
181 | |||
182 | // Clipping region enable control |
||
183 | extern SHORT _clipRgn; |
||
184 | |||
185 | // Left clipping region border |
||
186 | extern SHORT _clipLeft; |
||
187 | |||
188 | // Top clipping region border |
||
189 | extern SHORT _clipTop; |
||
190 | |||
191 | // Right clipping region border |
||
192 | extern SHORT _clipRight; |
||
193 | |||
194 | // Bottom clipping region border |
||
195 | extern SHORT _clipBottom; |
||
196 | |||
197 | /********************************************************************* |
||
198 | * Function: void ResetDevice() |
||
199 | * |
||
200 | * Overview: Initializes LCD module. |
||
201 | * |
||
202 | * PreCondition: none |
||
203 | * |
||
204 | * Input: none |
||
205 | * |
||
206 | * Output: none |
||
207 | * |
||
208 | * Side Effects: none |
||
209 | * |
||
210 | ********************************************************************/ |
||
211 | void ResetDevice(void); |
||
212 | |||
213 | /********************************************************************* |
||
214 | * Macros: GetMaxX() |
||
215 | * |
||
216 | * Overview: Returns maximum horizontal coordinate. |
||
217 | * |
||
218 | * PreCondition: none |
||
219 | * |
||
220 | * Input: none |
||
221 | * |
||
222 | * Output: Maximum horizontal coordinate. |
||
223 | * |
||
224 | * Side Effects: none |
||
225 | * |
||
226 | ********************************************************************/ |
||
227 | #define GetMaxX() (DISP_HOR_RESOLUTION - 1) |
||
228 | |||
229 | /********************************************************************* |
||
230 | * Macros: GetMaxY() |
||
231 | * |
||
232 | * Overview: Returns maximum vertical coordinate. |
||
233 | * |
||
234 | * PreCondition: none |
||
235 | * |
||
236 | * Input: none |
||
237 | * |
||
238 | * Output: Maximum vertical coordinate. |
||
239 | * |
||
240 | * Side Effects: none |
||
241 | * |
||
242 | ********************************************************************/ |
||
243 | #define GetMaxY() (DISP_VER_RESOLUTION - 1) |
||
244 | |||
245 | /********************************************************************* |
||
246 | * Macros: SetColor(color) |
||
247 | * |
||
248 | * Overview: Sets current drawing color. |
||
249 | * |
||
250 | * PreCondition: none |
||
251 | * |
||
252 | * Input: color - Color coded in 5:6:5 RGB format. |
||
253 | * |
||
254 | * Output: none |
||
255 | * |
||
256 | * Side Effects: none |
||
257 | * |
||
258 | ********************************************************************/ |
||
259 | #define SetColor(color) _color = (BYTE) (color & 0x03); |
||
260 | |||
261 | /********************************************************************* |
||
262 | * Macros: GetColor() |
||
263 | * |
||
264 | * Overview: Returns current drawing color. |
||
265 | * |
||
266 | * PreCondition: none |
||
267 | * |
||
268 | * Input: none |
||
269 | * |
||
270 | * Output: Color coded in 5:6:5 RGB format. |
||
271 | * |
||
272 | * Side Effects: none |
||
273 | * |
||
274 | ********************************************************************/ |
||
275 | #define GetColor() _color |
||
276 | |||
277 | /********************************************************************* |
||
278 | * Macros: SetActivePage(page) |
||
279 | * |
||
280 | * Overview: Sets active graphic page. |
||
281 | * |
||
282 | * PreCondition: none |
||
283 | * |
||
284 | * Input: page - Graphic page number. |
||
285 | * |
||
286 | * Output: none |
||
287 | * |
||
288 | * Side Effects: none |
||
289 | * |
||
290 | ********************************************************************/ |
||
291 | #define SetActivePage(page) |
||
292 | |||
293 | /********************************************************************* |
||
294 | * Macros: SetVisualPage(page) |
||
295 | * |
||
296 | * Overview: Sets graphic page to display. |
||
297 | * |
||
298 | * PreCondition: none |
||
299 | * |
||
300 | * Input: page - Graphic page number |
||
301 | * |
||
302 | * Output: none |
||
303 | * |
||
304 | * Side Effects: none |
||
305 | * |
||
306 | ********************************************************************/ |
||
307 | #define SetVisualPage(page) |
||
308 | |||
309 | /********************************************************************* |
||
310 | * Function: void PutPixel(SHORT x, SHORT y) |
||
311 | * |
||
312 | * Overview: Puts pixel with the given x,y coordinate position. |
||
313 | * |
||
314 | * PreCondition: none |
||
315 | * |
||
316 | * Input: x - x position of the pixel. |
||
317 | * y - y position of the pixel. |
||
318 | * |
||
319 | * Output: none |
||
320 | * |
||
321 | * Side Effects: none |
||
322 | * |
||
323 | ********************************************************************/ |
||
324 | void PutPixel(SHORT x, SHORT y); |
||
325 | |||
326 | /********************************************************************* |
||
327 | * Function: WORD GetPixel(SHORT x, SHORT y) |
||
328 | * |
||
329 | * Overview: Returns pixel color at 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: pixel color |
||
337 | * |
||
338 | * Side Effects: none |
||
339 | * |
||
340 | ********************************************************************/ |
||
341 | WORD GetPixel(SHORT x, SHORT y); |
||
342 | |||
343 | /********************************************************************* |
||
344 | * Macros: SetClipRgn(left, top, right, bottom) |
||
345 | * |
||
346 | * Overview: Sets clipping region. |
||
347 | * |
||
348 | * PreCondition: none |
||
349 | * |
||
350 | * Input: left - Defines the left clipping region border. |
||
351 | * top - Defines the top clipping region border. |
||
352 | * right - Defines the right clipping region border. |
||
353 | * bottom - Defines the bottom clipping region border. |
||
354 | * |
||
355 | * Output: none |
||
356 | * |
||
357 | * Side Effects: none |
||
358 | * |
||
359 | ********************************************************************/ |
||
360 | #define SetClipRgn(left, top, right, bottom) \ |
||
361 | _clipLeft = left; \ |
||
362 | _clipTop = top; \ |
||
363 | _clipRight = right; \ |
||
364 | _clipBottom = bottom; |
||
365 | |||
366 | /********************************************************************* |
||
367 | * Macros: GetClipLeft() |
||
368 | * |
||
369 | * Overview: Returns left clipping border. |
||
370 | * |
||
371 | * PreCondition: none |
||
372 | * |
||
373 | * Input: none |
||
374 | * |
||
375 | * Output: Left clipping border. |
||
376 | * |
||
377 | * Side Effects: none |
||
378 | * |
||
379 | ********************************************************************/ |
||
380 | #define GetClipLeft() _clipLeft |
||
381 | |||
382 | /********************************************************************* |
||
383 | * Macros: GetClipRight() |
||
384 | * |
||
385 | * Overview: Returns right clipping border. |
||
386 | * |
||
387 | * PreCondition: none |
||
388 | * |
||
389 | * Input: none |
||
390 | * |
||
391 | * Output: Right clipping border. |
||
392 | * |
||
393 | * Side Effects: none |
||
394 | * |
||
395 | ********************************************************************/ |
||
396 | #define GetClipRight() _clipRight |
||
397 | |||
398 | /********************************************************************* |
||
399 | * Macros: GetClipTop() |
||
400 | * |
||
401 | * Overview: Returns top clipping border. |
||
402 | * |
||
403 | * PreCondition: none |
||
404 | * |
||
405 | * Input: none |
||
406 | * |
||
407 | * Output: Top clipping border. |
||
408 | * |
||
409 | * Side Effects: none |
||
410 | * |
||
411 | ********************************************************************/ |
||
412 | #define GetClipTop() _clipTop |
||
413 | |||
414 | /********************************************************************* |
||
415 | * Macros: GetClipBottom() |
||
416 | * |
||
417 | * Overview: Returns bottom clipping border. |
||
418 | * |
||
419 | * PreCondition: none |
||
420 | * |
||
421 | * Input: none |
||
422 | * |
||
423 | * Output: Bottom clipping border. |
||
424 | * |
||
425 | * Side Effects: none |
||
426 | * |
||
427 | ********************************************************************/ |
||
428 | #define GetClipBottom() _clipBottom |
||
429 | |||
430 | /********************************************************************* |
||
431 | * Macros: SetClip(control) |
||
432 | * |
||
433 | * Overview: Enables/disables clipping. |
||
434 | * |
||
435 | * PreCondition: none |
||
436 | * |
||
437 | * Input: control - Enables or disables the clipping. |
||
438 | * - 0: Disable clipping |
||
439 | * - 1: Enable clipping |
||
440 | * |
||
441 | * Output: none |
||
442 | * |
||
443 | * Side Effects: none |
||
444 | * |
||
445 | ********************************************************************/ |
||
446 | #define SetClip(control) _clipRgn = control; |
||
447 | |||
448 | /********************************************************************* |
||
449 | * Macros: IsDeviceBusy() |
||
450 | * |
||
451 | * Overview: Returns non-zero if LCD controller is busy |
||
452 | * (previous drawing operation is not completed). |
||
453 | * |
||
454 | * PreCondition: none |
||
455 | * |
||
456 | * Input: none |
||
457 | * |
||
458 | * Output: Busy status. |
||
459 | * |
||
460 | * Side Effects: none |
||
461 | * |
||
462 | ********************************************************************/ |
||
463 | #define IsDeviceBusy() 0 |
||
464 | |||
465 | /********************************************************************* |
||
466 | * Macros: SetPalette(colorNum, color) |
||
467 | * |
||
468 | * Overview: Sets palette register. |
||
469 | * |
||
470 | * PreCondition: none |
||
471 | * |
||
472 | * Input: colorNum - Register number. |
||
473 | * color - Color. |
||
474 | * |
||
475 | * Output: none |
||
476 | * |
||
477 | * Side Effects: none |
||
478 | * |
||
479 | ********************************************************************/ |
||
480 | #define SetPalette(colorNum, color) |
||
481 | |||
482 | /********************************************************************* |
||
483 | * Function: void DelayMs(WORD time) |
||
484 | * |
||
485 | * Overview: Delays execution on time specified in milliseconds. |
||
486 | * The delay is correct only for 16MIPS. |
||
487 | * |
||
488 | * PreCondition: none |
||
489 | * |
||
490 | * Input: time - Delay in milliseconds. |
||
491 | * |
||
492 | * Output: none |
||
493 | * |
||
494 | * Side Effects: none |
||
495 | * |
||
496 | ********************************************************************/ |
||
497 | void DelayMs(WORD time); |
||
498 | |||
499 | /********************************************************************* |
||
500 | * Function: void ContrastSet(BYTE contrast) |
||
501 | * |
||
502 | * PreCondition: none |
||
503 | * |
||
504 | * Input: contrast value |
||
505 | * |
||
506 | * Output: none |
||
507 | * |
||
508 | * Side Effects: none |
||
509 | * |
||
510 | * Overview: sets contrast |
||
511 | * |
||
512 | * Note: none |
||
513 | * |
||
514 | ********************************************************************/ |
||
515 | void ContrastSet(BYTE contrast); |
||
516 | #endif // _UC1610_H |
Powered by WebSVN v2.8.3