?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*****************************************************************************
2 * Module for Microchip Graphics Library
3 * Custom display controller driver template
4 *****************************************************************************
5 * FileName: CustomDisplayDriver.h
6 * Dependencies: p24Fxxxx.h or plib.h
7 * Processor: PIC24F, PIC24H, dsPIC, PIC32
8 * Compiler: MPLAB C30, MPLAB C32
9 * Linker: MPLAB LINK30, MPLAB LINK32
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 *
39 *****************************************************************************/
40 #ifndef _CUSTOM_DISPLAY_DRIVER_H
41 #define _CUSTOM_DISPLAY_DRIVER_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 // Define this to implement PutImage function in the driver.
75 //#define USE_DRV_PUTIMAGE
76 #ifndef DISP_HOR_RESOLUTION
77 #error DISP_HOR_RESOLUTION must be defined in GraphicsConfig.h
78 #endif
79 #ifndef DISP_VER_RESOLUTION
80 #error DISP_VER_RESOLUTION must be defined in GraphicsConfig.h
81 #endif
82 #ifndef COLOR_DEPTH
83 #error COLOR_DEPTH must be defined in GraphicsConfig.h
84 #endif
85 #ifndef DISP_ORIENTATION
86 #error DISP_ORIENTATION must be defined in GraphicsConfig.h
87 #endif
88  
89 /*********************************************************************
90 * Overview: Clipping region control codes to be used with SetClip(...)
91 * function.
92 *********************************************************************/
93 #define CLIP_DISABLE 0 // Disables clipping.
94 #define CLIP_ENABLE 1 // Enables clipping.
95  
96 /*********************************************************************
97 * Overview: Some basic colors definitions.
98 *********************************************************************/
99 #define BLACK RGB565CONVERT(0, 0, 0)
100 #define BRIGHTBLUE RGB565CONVERT(0, 0, 255)
101 #define BRIGHTGREEN RGB565CONVERT(0, 255, 0)
102 #define BRIGHTCYAN RGB565CONVERT(0, 255, 255)
103 #define BRIGHTRED RGB565CONVERT(255, 0, 0)
104 #define BRIGHTMAGENTA RGB565CONVERT(255, 0, 255)
105 #define BRIGHTYELLOW RGB565CONVERT(255, 255, 0)
106 #define BLUE RGB565CONVERT(0, 0, 128)
107 #define GREEN RGB565CONVERT(0, 128, 0)
108 #define CYAN RGB565CONVERT(0, 128, 128)
109 #define RED RGB565CONVERT(128, 0, 0)
110 #define MAGENTA RGB565CONVERT(128, 0, 128)
111 #define BROWN RGB565CONVERT(255, 128, 0)
112 #define LIGHTGRAY RGB565CONVERT(128, 128, 128)
113 #define DARKGRAY RGB565CONVERT(64, 64, 64)
114 #define LIGHTBLUE RGB565CONVERT(128, 128, 255)
115 #define LIGHTGREEN RGB565CONVERT(128, 255, 128)
116 #define LIGHTCYAN RGB565CONVERT(128, 255, 255)
117 #define LIGHTRED RGB565CONVERT(255, 128, 128)
118 #define LIGHTMAGENTA RGB565CONVERT(255, 128, 255)
119 #define YELLOW RGB565CONVERT(255, 255, 128)
120 #define WHITE RGB565CONVERT(255, 255, 255)
121 #define GRAY0 RGB565CONVERT(224, 224, 224)
122 #define GRAY1 RGB565CONVERT(192, 192, 192)
123 #define GRAY2 RGB565CONVERT(160, 160, 160)
124 #define GRAY3 RGB565CONVERT(128, 128, 128)
125 #define GRAY4 RGB565CONVERT(96, 96, 96)
126 #define GRAY5 RGB565CONVERT(64, 64, 64)
127 #define GRAY6 RGB565CONVERT(32, 32, 32)
128  
129 // Color
130 extern WORD_VAL _color;
131  
132 /*********************************************************************
133 * Overview: Clipping region control and border settings.
134 *
135 *********************************************************************/
136  
137 // Clipping region enable control
138 extern SHORT _clipRgn;
139  
140 // Left clipping region border
141 extern SHORT _clipLeft;
142  
143 // Top clipping region border
144 extern SHORT _clipTop;
145  
146 // Right clipping region border
147 extern SHORT _clipRight;
148  
149 // Bottom clipping region border
150 extern SHORT _clipBottom;
151  
152 /*********************************************************************
153 * Function: void ResetDevice()
154 *
155 * Overview: Initializes LCD module.
156 *
157 * PreCondition: none
158 *
159 * Input: none
160 *
161 * Output: none
162 *
163 * Side Effects: none
164 *
165 ********************************************************************/
166 void ResetDevice(void);
167  
168 /*********************************************************************
169 * Macros: GetMaxX()
170 *
171 * Overview: Returns maximum horizontal coordinate.
172 *
173 * PreCondition: none
174 *
175 * Input: none
176 *
177 * Output: Maximum horizontal coordinate.
178 *
179 * Side Effects: none
180 *
181 ********************************************************************/
182 #if (DISP_ORIENTATION == 90) || (DISP_ORIENTATION == 270)
183 #define GetMaxX() (DISP_VER_RESOLUTION - 1)
184 #elif (DISP_ORIENTATION == 0) || (DISP_ORIENTATION == 180)
185 #define GetMaxX() (DISP_HOR_RESOLUTION - 1)
186 #endif
187  
188 /*********************************************************************
189 * Macros: GetMaxY()
190 *
191 * Overview: Returns maximum vertical coordinate.
192 *
193 * PreCondition: none
194 *
195 * Input: none
196 *
197 * Output: Maximum vertical coordinate.
198 *
199 * Side Effects: none
200 *
201 ********************************************************************/
202 #if (DISP_ORIENTATION == 90) || (DISP_ORIENTATION == 270)
203 #define GetMaxY() (DISP_HOR_RESOLUTION - 1)
204 #elif (DISP_ORIENTATION == 0) || (DISP_ORIENTATION == 180)
205 #define GetMaxY() (DISP_VER_RESOLUTION - 1)
206 #endif
207  
208 /*********************************************************************
209 * Macros: SetColor(color)
210 *
211 * Overview: Sets current drawing color.
212 *
213 * PreCondition: none
214 *
215 * Input: color - Color coded in 5:6:5 RGB format.
216 *
217 * Output: none
218 *
219 * Side Effects: none
220 *
221 ********************************************************************/
222 #define SetColor(color) _color.Val = color;
223  
224 /*********************************************************************
225 * Macros: GetColor()
226 *
227 * Overview: Returns current drawing color.
228 *
229 * PreCondition: none
230 *
231 * Input: none
232 *
233 * Output: Color coded in 5:6:5 RGB format.
234 *
235 * Side Effects: none
236 *
237 ********************************************************************/
238 #define GetColor() _color.Val
239  
240 /*********************************************************************
241 * Macros: SetActivePage(page)
242 *
243 * Overview: Sets active graphic page.
244 *
245 * PreCondition: none
246 *
247 * Input: page - Graphic page number.
248 *
249 * Output: none
250 *
251 * Side Effects: none
252 *
253 ********************************************************************/
254 #define SetActivePage(page)
255  
256 /*********************************************************************
257 * Macros: SetVisualPage(page)
258 *
259 * Overview: Sets graphic page to display.
260 *
261 * PreCondition: none
262 *
263 * Input: page - Graphic page number
264 *
265 * Output: none
266 *
267 * Side Effects: none
268 *
269 ********************************************************************/
270 #define SetVisualPage(page)
271  
272 /*********************************************************************
273 * Function: void PutPixel(SHORT x, SHORT y)
274 *
275 * Overview: Puts pixel with the given x,y coordinate position.
276 *
277 * PreCondition: none
278 *
279 * Input: x - x position of the pixel.
280 * y - y position of the pixel.
281 *
282 * Output: none
283 *
284 * Side Effects: none
285 *
286 ********************************************************************/
287 void PutPixel(SHORT x, SHORT y);
288  
289 /*********************************************************************
290 * Function: WORD GetPixel(SHORT x, SHORT y)
291 *
292 * Overview: Returns pixel color at the given x,y coordinate position.
293 *
294 * PreCondition: none
295 *
296 * Input: x - x position of the pixel.
297 * y - y position of the pixel.
298 *
299 * Output: pixel color
300 *
301 * Side Effects: none
302 *
303 ********************************************************************/
304 WORD GetPixel(SHORT x, SHORT y);
305  
306 /*********************************************************************
307 * Macros: SetClipRgn(left, top, right, bottom)
308 *
309 * Overview: Sets clipping region.
310 *
311 * PreCondition: none
312 *
313 * Input: left - Defines the left clipping region border.
314 * top - Defines the top clipping region border.
315 * right - Defines the right clipping region border.
316 * bottom - Defines the bottom clipping region border.
317 *
318 * Output: none
319 *
320 * Side Effects: none
321 *
322 ********************************************************************/
323 #define SetClipRgn(left, top, right, bottom) \
324 _clipLeft = left; \
325 _clipTop = top; \
326 _clipRight = right; \
327 _clipBottom = bottom;
328  
329 /*********************************************************************
330 * Macros: GetClipLeft()
331 *
332 * Overview: Returns left clipping border.
333 *
334 * PreCondition: none
335 *
336 * Input: none
337 *
338 * Output: Left clipping border.
339 *
340 * Side Effects: none
341 *
342 ********************************************************************/
343 #define GetClipLeft() _clipLeft
344  
345 /*********************************************************************
346 * Macros: GetClipRight()
347 *
348 * Overview: Returns right clipping border.
349 *
350 * PreCondition: none
351 *
352 * Input: none
353 *
354 * Output: Right clipping border.
355 *
356 * Side Effects: none
357 *
358 ********************************************************************/
359 #define GetClipRight() _clipRight
360  
361 /*********************************************************************
362 * Macros: GetClipTop()
363 *
364 * Overview: Returns top clipping border.
365 *
366 * PreCondition: none
367 *
368 * Input: none
369 *
370 * Output: Top clipping border.
371 *
372 * Side Effects: none
373 *
374 ********************************************************************/
375 #define GetClipTop() _clipTop
376  
377 /*********************************************************************
378 * Macros: GetClipBottom()
379 *
380 * Overview: Returns bottom clipping border.
381 *
382 * PreCondition: none
383 *
384 * Input: none
385 *
386 * Output: Bottom clipping border.
387 *
388 * Side Effects: none
389 *
390 ********************************************************************/
391 #define GetClipBottom() _clipBottom
392  
393 /*********************************************************************
394 * Macros: SetClip(control)
395 *
396 * Overview: Enables/disables clipping.
397 *
398 * PreCondition: none
399 *
400 * Input: control - Enables or disables the clipping.
401 * - 0: Disable clipping
402 * - 1: Enable clipping
403 *
404 * Output: none
405 *
406 * Side Effects: none
407 *
408 ********************************************************************/
409 #define SetClip(control) _clipRgn = control;
410  
411 /*********************************************************************
412 * Macros: IsDeviceBusy()
413 *
414 * Overview: Returns non-zero if LCD controller is busy
415 * (previous drawing operation is not completed).
416 *
417 * PreCondition: none
418 *
419 * Input: none
420 *
421 * Output: Busy status.
422 *
423 * Side Effects: none
424 *
425 ********************************************************************/
426 #define IsDeviceBusy() 0
427  
428 /*********************************************************************
429 * Macros: SetPalette(colorNum, color)
430 *
431 * Overview: Sets palette register.
432 *
433 * PreCondition: none
434 *
435 * Input: colorNum - Register number.
436 * color - Color.
437 *
438 * Output: none
439 *
440 * Side Effects: none
441 *
442 ********************************************************************/
443 #define SetPalette(colorNum, color)
444  
445 /*********************************************************************
446 * Function: void DelayMs(WORD time)
447 *
448 * Overview: Delays execution on time specified in milliseconds.
449 * The delay is correct only for 16MIPS.
450 *
451 * PreCondition: none
452 *
453 * Input: time - Delay in milliseconds.
454 *
455 * Output: none
456 *
457 * Side Effects: none
458 *
459 ********************************************************************/
460 void DelayMs(WORD time);
461 #endif // _CUSTOM_DISPLAY_DRIVER_H
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3