Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /***************************************************************************** |
2 | * Module for Microchip Graphics Library |
||
3 | * Solomon Systech. SSD1339 OLED display controller driver |
||
4 | ***************************************************************************** |
||
5 | * FileName: SSD1339.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 11/12/07 Version 1.0 release |
||
39 | *****************************************************************************/ |
||
40 | #ifndef _SSD1339_H |
||
41 | #define _SSD1339_H |
||
42 | |||
43 | #include <p24Fxxxx.h> |
||
44 | #include "GraphicsConfig.h" |
||
45 | #include "GenericTypeDefs.h" |
||
46 | |||
47 | // Additional hardware-accelerated functions implemented in the driver. |
||
48 | // These definitions exclude the PutPixel()-based functions from compilation |
||
49 | // in the primitives layer (Primitive.c file). |
||
50 | //#define USE_DRV_FONT |
||
51 | //#define USE_DRV_LINE |
||
52 | //#define USE_DRV_CIRCLE |
||
53 | //#define USE_DRV_FILLCIRCLE |
||
54 | #define USE_DRV_BAR |
||
55 | #define USE_DRV_CLEARDEVICE |
||
56 | #define USE_DRV_PUTIMAGE |
||
57 | |||
58 | #ifdef USE_16BIT_PMP |
||
59 | #error This driver doesn't support 16-bit PMP (remove USE_16BIT_PMP option from HardwareProfile.h) |
||
60 | #endif |
||
61 | #ifndef DISP_HOR_RESOLUTION |
||
62 | #error DISP_HOR_RESOLUTION must be defined in HardwareProfile.h |
||
63 | #endif |
||
64 | #ifndef DISP_VER_RESOLUTION |
||
65 | #error DISP_VER_RESOLUTION must be defined in HardwareProfile.h |
||
66 | #endif |
||
67 | #ifndef COLOR_DEPTH |
||
68 | #error COLOR_DEPTH must be defined in HardwareProfile.h |
||
69 | #endif |
||
70 | #ifndef DISP_ORIENTATION |
||
71 | #error DISP_ORIENTATION must be defined in HardwareProfile.h |
||
72 | #endif |
||
73 | |||
74 | /********************************************************************* |
||
75 | * Overview: Horizontal and vertical screen size. |
||
76 | *********************************************************************/ |
||
77 | #if (DISP_HOR_RESOLUTION != 128) |
||
78 | #error This driver doesn't supports this resolution. Horisontal resolution must be 128 pixels. |
||
79 | #endif |
||
80 | #if (DISP_VER_RESOLUTION != 128) |
||
81 | #error This driver doesn't supports this resolution. Vertical resolution must be 128 pixels. |
||
82 | #endif |
||
83 | |||
84 | /********************************************************************* |
||
85 | * Overview: Display orientation. |
||
86 | *********************************************************************/ |
||
87 | #if (DISP_ORIENTATION != 0) |
||
88 | #error This driver doesn't support this orientation. |
||
89 | #endif |
||
90 | |||
91 | /********************************************************************* |
||
92 | * Overview: Color depth. |
||
93 | *********************************************************************/ |
||
94 | #if (COLOR_DEPTH != 16) |
||
95 | #error This driver doesn't support this color depth. It should be 16. |
||
96 | #endif |
||
97 | |||
98 | // Clipping region control codes |
||
99 | #define CLIP_DISABLE 0 |
||
100 | #define CLIP_ENABLE 1 |
||
101 | |||
102 | // Color codes |
||
103 | #define BLACK (WORD) 0x0000 |
||
104 | #define BRIGHTBLUE (WORD) 0x001f |
||
105 | #define BRIGHTGREEN (WORD) 0x07e0 |
||
106 | #define BRIGHTCYAN (WORD) 0x07ff |
||
107 | #define BRIGHTRED (WORD) 0xf800 |
||
108 | #define BRIGHTMAGENTA (WORD) 0xf81f |
||
109 | #define BRIGHTYELLOW (WORD) 0xffe0 |
||
110 | #define BLUE (WORD) 0x0010 |
||
111 | #define GREEN (WORD) 0x0400 |
||
112 | #define CYAN (WORD) 0x0410 |
||
113 | #define RED (WORD) 0x8000 |
||
114 | #define MAGENTA (WORD) 0x8010 |
||
115 | #define BROWN (WORD) 0xfc00 |
||
116 | #define LIGHTGRAY (WORD) 0x8410 |
||
117 | #define DARKGRAY (WORD) 0x4208 |
||
118 | #define LIGHTBLUE (WORD) 0x841f |
||
119 | #define LIGHTGREEN (WORD) 0x87f0 |
||
120 | #define LIGHTCYAN (WORD) 0x87ff |
||
121 | #define LIGHTRED (WORD) 0xfc10 |
||
122 | #define LIGHTMAGENTA (WORD) 0xfc1f |
||
123 | #define YELLOW (WORD) 0xfff0 |
||
124 | #define WHITE (WORD) 0xffff |
||
125 | |||
126 | #define GRAY0 (WORD) 0xe71c |
||
127 | #define GRAY1 (WORD) 0xc618 |
||
128 | #define GRAY2 (WORD) 0xa514 |
||
129 | #define GRAY3 (WORD) 0x8410 |
||
130 | #define GRAY4 (WORD) 0x630c |
||
131 | #define GRAY5 (WORD) 0x4208 |
||
132 | #define GRAY6 (WORD) 0x2104 |
||
133 | |||
134 | // Color |
||
135 | extern WORD_VAL _color; |
||
136 | |||
137 | // Clipping region control |
||
138 | extern SHORT _clipRgn; |
||
139 | |||
140 | // Clipping region borders |
||
141 | extern SHORT _clipLeft; |
||
142 | extern SHORT _clipTop; |
||
143 | extern SHORT _clipRight; |
||
144 | extern SHORT _clipBottom; |
||
145 | |||
146 | // Display commands |
||
147 | #define CMD_COL 0x15 |
||
148 | #define CMD_ROW 0x75 |
||
149 | #define CMD_WRITE 0x5C |
||
150 | #define CMD_READ 0x5D |
||
151 | #define CMD_MODE 0xA0 |
||
152 | #define CMD_SRTLINE 0xA1 |
||
153 | #define CMD_DISPON 0xAF |
||
154 | #define CMD_DISPOFF 0xAE |
||
155 | #define CMD_FILLMODE 0x92 |
||
156 | #define CMD_RECT 0x84 |
||
157 | |||
158 | /********************************************************************* |
||
159 | * Function: void ResetDevice() |
||
160 | * |
||
161 | * PreCondition: none |
||
162 | * |
||
163 | * Input: none |
||
164 | * |
||
165 | * Output: none |
||
166 | * |
||
167 | * Side Effects: none |
||
168 | * |
||
169 | * Overview: resets device, initialize PMP |
||
170 | * |
||
171 | * Note: none |
||
172 | * |
||
173 | ********************************************************************/ |
||
174 | void ResetDevice(void); |
||
175 | |||
176 | /********************************************************************* |
||
177 | * Macros: GetMaxX() |
||
178 | * |
||
179 | * PreCondition: none |
||
180 | * |
||
181 | * Input: none |
||
182 | * |
||
183 | * Output: maximum horizontal coordinate |
||
184 | * |
||
185 | * Side Effects: none |
||
186 | * |
||
187 | * Overview: returns maximum horizontal coordinate |
||
188 | * |
||
189 | * Note: none |
||
190 | * |
||
191 | ********************************************************************/ |
||
192 | #define GetMaxX() (DISP_HOR_RESOLUTION - 1) |
||
193 | |||
194 | /********************************************************************* |
||
195 | * Macros: GetMaxY() |
||
196 | * |
||
197 | * PreCondition: none |
||
198 | * |
||
199 | * Input: none |
||
200 | * |
||
201 | * Output: maximum vertical coordinate |
||
202 | * |
||
203 | * Side Effects: none |
||
204 | * |
||
205 | * Overview: returns maximum vertical coordinate |
||
206 | * |
||
207 | * Note: none |
||
208 | * |
||
209 | ********************************************************************/ |
||
210 | #define GetMaxY() (DISP_VER_RESOLUTION - 1) |
||
211 | |||
212 | /********************************************************************* |
||
213 | * Macros: SetColor(color) |
||
214 | * |
||
215 | * PreCondition: none |
||
216 | * |
||
217 | * Input: color coded in format: |
||
218 | * bits 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 |
||
219 | * color R R R R R G G G G G G B B B B B |
||
220 | * |
||
221 | * Output: none |
||
222 | * |
||
223 | * Side Effects: none |
||
224 | * |
||
225 | * Overview: sets current color |
||
226 | * |
||
227 | * Note: none |
||
228 | * |
||
229 | ********************************************************************/ |
||
230 | #define SetColor(color) _color.Val = color; |
||
231 | |||
232 | /********************************************************************* |
||
233 | * Macros: GetColor() |
||
234 | * |
||
235 | * PreCondition: none |
||
236 | * |
||
237 | * Input: none |
||
238 | * |
||
239 | * Output: color coded in format: |
||
240 | * bits 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 |
||
241 | * color R R R R R G G G G G G B B B B B |
||
242 | * |
||
243 | * Side Effects: none |
||
244 | * |
||
245 | * Overview: returns current color |
||
246 | * |
||
247 | * Note: none |
||
248 | * |
||
249 | ********************************************************************/ |
||
250 | #define GetColor() _color.Val |
||
251 | |||
252 | /********************************************************************* |
||
253 | * Macros: SetActivePage(page) |
||
254 | * |
||
255 | * PreCondition: none |
||
256 | * |
||
257 | * Input: graphic page number |
||
258 | * |
||
259 | * Output: none |
||
260 | * |
||
261 | * Side Effects: none |
||
262 | * |
||
263 | * Overview: sets active graphic page |
||
264 | * |
||
265 | * Note: SSD1339 has only page |
||
266 | * |
||
267 | ********************************************************************/ |
||
268 | #define SetActivePage(page) |
||
269 | |||
270 | /********************************************************************* |
||
271 | * Macros: SetVisualPage(page) |
||
272 | * |
||
273 | * PreCondition: none |
||
274 | * |
||
275 | * Input: graphic page number |
||
276 | * |
||
277 | * Output: none |
||
278 | * |
||
279 | * Side Effects: none |
||
280 | * |
||
281 | * Overview: sets graphic page to display |
||
282 | * |
||
283 | * Note: SSD1339 has only page |
||
284 | * |
||
285 | ********************************************************************/ |
||
286 | #define SetVisualPage(page) |
||
287 | |||
288 | /********************************************************************* |
||
289 | * Function: void PutPixel(SHORT x, SHORT y) |
||
290 | * |
||
291 | * PreCondition: none |
||
292 | * |
||
293 | * Input: x,y - pixel coordinates |
||
294 | * |
||
295 | * Output: none |
||
296 | * |
||
297 | * Side Effects: none |
||
298 | * |
||
299 | * Overview: puts pixel |
||
300 | * |
||
301 | * Note: none |
||
302 | * |
||
303 | ********************************************************************/ |
||
304 | void PutPixel(SHORT x, SHORT y); |
||
305 | |||
306 | /********************************************************************* |
||
307 | * Function: WORD GetPixel(SHORT x, SHORT y) |
||
308 | * |
||
309 | * PreCondition: none |
||
310 | * |
||
311 | * Input: x,y - pixel coordinates |
||
312 | * |
||
313 | * Output: pixel color |
||
314 | * |
||
315 | * Side Effects: none |
||
316 | * |
||
317 | * Overview: returns pixel color at x,y position |
||
318 | * |
||
319 | * Note: none |
||
320 | * |
||
321 | ********************************************************************/ |
||
322 | WORD GetPixel(SHORT x, SHORT y); |
||
323 | |||
324 | /********************************************************************* |
||
325 | * Macros: SetClipRgn(left, top, right, bottom) |
||
326 | * |
||
327 | * PreCondition: none |
||
328 | * |
||
329 | * Input: left,top,right,bottom - clipping region borders |
||
330 | * |
||
331 | * Output: none |
||
332 | * |
||
333 | * Side Effects: none |
||
334 | * |
||
335 | * Overview: sets clipping region |
||
336 | * |
||
337 | * Note: none |
||
338 | * |
||
339 | ********************************************************************/ |
||
340 | #define SetClipRgn(left, top, right, bottom) \ |
||
341 | _clipLeft = left; \ |
||
342 | _clipTop = top; \ |
||
343 | _clipRight = right; \ |
||
344 | _clipBottom = bottom; |
||
345 | |||
346 | /********************************************************************* |
||
347 | * Macros: GetClipLeft() |
||
348 | * |
||
349 | * PreCondition: none |
||
350 | * |
||
351 | * Input: none |
||
352 | * |
||
353 | * Output: left clipping border |
||
354 | * |
||
355 | * Side Effects: none |
||
356 | * |
||
357 | * Overview: returns left clipping border |
||
358 | * |
||
359 | * Note: none |
||
360 | * |
||
361 | ********************************************************************/ |
||
362 | #define GetClipLeft() _clipLeft |
||
363 | |||
364 | /********************************************************************* |
||
365 | * Macros: GetClipRight() |
||
366 | * |
||
367 | * PreCondition: none |
||
368 | * |
||
369 | * Input: none |
||
370 | * |
||
371 | * Output: right clipping border |
||
372 | * |
||
373 | * Side Effects: none |
||
374 | * |
||
375 | * Overview: returns right clipping border |
||
376 | * |
||
377 | * Note: none |
||
378 | * |
||
379 | ********************************************************************/ |
||
380 | #define GetClipRight() _clipRight |
||
381 | |||
382 | /********************************************************************* |
||
383 | * Macros: GetClipTop() |
||
384 | * |
||
385 | * PreCondition: none |
||
386 | * |
||
387 | * Input: none |
||
388 | * |
||
389 | * Output: top clipping border |
||
390 | * |
||
391 | * Side Effects: none |
||
392 | * |
||
393 | * Overview: returns top clipping border |
||
394 | * |
||
395 | * Note: none |
||
396 | * |
||
397 | ********************************************************************/ |
||
398 | #define GetClipTop() _clipTop |
||
399 | |||
400 | /********************************************************************* |
||
401 | * Macros: GetClipBottom() |
||
402 | * |
||
403 | * PreCondition: none |
||
404 | * |
||
405 | * Input: none |
||
406 | * |
||
407 | * Output: bottom clipping border |
||
408 | * |
||
409 | * Side Effects: none |
||
410 | * |
||
411 | * Overview: returns bottom clipping border |
||
412 | * |
||
413 | * Note: none |
||
414 | * |
||
415 | ********************************************************************/ |
||
416 | #define GetClipBottom() _clipBottom |
||
417 | |||
418 | /********************************************************************* |
||
419 | * Macros: SetClip(control) |
||
420 | * |
||
421 | * PreCondition: none |
||
422 | * |
||
423 | * Input: control - 0 disable/ 1 enable |
||
424 | * |
||
425 | * Output: none |
||
426 | * |
||
427 | * Side Effects: none |
||
428 | * |
||
429 | * Overview: enables/disables clipping |
||
430 | * |
||
431 | * Note: none |
||
432 | * |
||
433 | ********************************************************************/ |
||
434 | #define SetClip(control) _clipRgn = control; |
||
435 | |||
436 | /********************************************************************* |
||
437 | * Macros: IsDeviceBusy() |
||
438 | * |
||
439 | * PreCondition: none |
||
440 | * |
||
441 | * Input: none |
||
442 | * |
||
443 | * Output: busy status |
||
444 | * |
||
445 | * Side Effects: none |
||
446 | * |
||
447 | * Overview: returns non-zero if LCD controller is busy |
||
448 | * (previous drawing operation is not complete) |
||
449 | * |
||
450 | * Note: SSD1339 is always accessible |
||
451 | * |
||
452 | ********************************************************************/ |
||
453 | #define IsDeviceBusy() 0 |
||
454 | |||
455 | /********************************************************************* |
||
456 | * Macros: SetPalette(colorNum, color) |
||
457 | * |
||
458 | * PreCondition: none |
||
459 | * |
||
460 | * Input: colorNum - register number, color - color |
||
461 | * |
||
462 | * Output: none |
||
463 | * |
||
464 | * Side Effects: none |
||
465 | * |
||
466 | * Overview: sets palette register |
||
467 | * |
||
468 | * Note: SSD1339 has no palette |
||
469 | * |
||
470 | ********************************************************************/ |
||
471 | #define SetPalette(colorNum, color) |
||
472 | |||
473 | |||
474 | #endif // _SSD1339_H |
Powered by WebSVN v2.8.3