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