diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-04-25 13:45:23 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-04-25 13:45:23 +0000 |
commit | 30e8c03a425851ee7b1e6fbc98e4cdc389af6680 (patch) | |
tree | b786675d4be4bad8705a9f655aef51bab49983e6 /firmware | |
parent | 9c1299c9c1892efc67c75f8cd551ffe9f2863156 (diff) | |
download | rockbox-30e8c03a425851ee7b1e6fbc98e4cdc389af6680.tar.gz rockbox-30e8c03a425851ee7b1e6fbc98e4cdc389af6680.zip |
Cleaning up the lcd API; not finished
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@233 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd.c | 150 | ||||
-rw-r--r-- | firmware/drivers/lcd.h | 125 |
2 files changed, 123 insertions, 152 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c index 46d372da44..868883ef0a 100644 --- a/firmware/drivers/lcd.c +++ b/firmware/drivers/lcd.c | |||
@@ -20,6 +20,32 @@ | |||
20 | #include "config.h" | 20 | #include "config.h" |
21 | #include "lcd.h" | 21 | #include "lcd.h" |
22 | 22 | ||
23 | #define LCDR (PBDR+1) | ||
24 | |||
25 | /* PA14 : /LCD-BL --- backlight */ | ||
26 | #define LCD_BL 6 | ||
27 | |||
28 | #ifdef HAVE_LCD_CHARCELLS | ||
29 | |||
30 | #define LCD_DS 1 // PB0 = 1 --- 0001 --- LCD-DS | ||
31 | #define LCD_CS 2 // PB1 = 1 --- 0010 --- /LCD-CS | ||
32 | #define LCD_SD 4 // PB2 = 1 --- 0100 --- LCD-SD | ||
33 | #define LCD_SC 8 // PB3 = 1 --- 1000 --- LCD-SC | ||
34 | #ifndef JBP_OLD | ||
35 | # define LCD_CONTRAST_SET ((char)0x50) | ||
36 | # define LCD_CRAM ((char)0x80) /* Characters */ | ||
37 | # define LCD_PRAM ((char)0xC0) /* Patterns */ | ||
38 | # define LCD_IRAM ((char)0x40) /* Icons */ | ||
39 | #else | ||
40 | # define LCD_CONTRAST_SET ((char)0xA8) | ||
41 | # define LCD_CRAM ((char)0xB0) /* Characters */ | ||
42 | # define LCD_PRAM ((char)0x80) /* Patterns */ | ||
43 | # define LCD_IRAM ((char)0xE0) /* Icons */ | ||
44 | #endif | ||
45 | #define LCD_ASCII(c) (lcd_ascii[(c)&255]) | ||
46 | #define LCD_CURSOR(x,y) ((char)(LCD_CRAM+((y)*16+(x)))) | ||
47 | #define LCD_ICON(i) ((char)(LCD_IRAM+i)) | ||
48 | |||
23 | #ifndef SIMULATOR | 49 | #ifndef SIMULATOR |
24 | /* | 50 | /* |
25 | * About /CS,DS,SC,SD | 51 | * About /CS,DS,SC,SD |
@@ -71,12 +97,11 @@ | |||
71 | /* | 97 | /* |
72 | * Enter a LCD session : | 98 | * Enter a LCD session : |
73 | * | 99 | * |
74 | * QI(LCDR) &= ~(LCD_CS|LCD_DS|LCD_SD|LCD_SC); | 100 | * LCDR &= ~(LCD_CS|LCD_DS|LCD_SD|LCD_SC); |
75 | */ | 101 | */ |
76 | static void lcd_start (void) | 102 | static void lcd_start (void) |
77 | { | 103 | { |
78 | asm | 104 | asm("and.b %0, @(r0,gbr)" |
79 | ("and.b\t%0,@(r0,gbr)" | ||
80 | : | 105 | : |
81 | : /* %0 */ "I"(~(LCD_CS|LCD_DS|LCD_SD|LCD_SC)), | 106 | : /* %0 */ "I"(~(LCD_CS|LCD_DS|LCD_SD|LCD_SC)), |
82 | /* %1 */ "z"(LCDR)); | 107 | /* %1 */ "z"(LCDR)); |
@@ -85,7 +110,7 @@ static void lcd_start (void) | |||
85 | /* | 110 | /* |
86 | * Leave a LCD session : | 111 | * Leave a LCD session : |
87 | * | 112 | * |
88 | * QI(LCDR) |= LCD_CS|LCD_RS|LCD_SD|LCD_SC; | 113 | * LCDR |= LCD_CS|LCD_RS|LCD_SD|LCD_SC; |
89 | */ | 114 | */ |
90 | static void lcd_stop (void) | 115 | static void lcd_stop (void) |
91 | { | 116 | { |
@@ -96,42 +121,42 @@ static void lcd_stop (void) | |||
96 | /* %1 */ "z"(LCDR)); | 121 | /* %1 */ "z"(LCDR)); |
97 | } | 122 | } |
98 | 123 | ||
99 | static void lcd_byte (int byte,int rs) | 124 | static void lcd_byte (int byte,bool data) |
125 | |||
100 | /* | 126 | /* |
101 | * char j = 0x80; | 127 | * char j = 0x80; |
102 | * if (rs) | 128 | * if (rs) |
103 | * do | 129 | * do |
104 | * { | 130 | * { |
105 | * QI(LCDR) &= ~(LCD_SC|LCD_SD); | 131 | * LCDR &= ~(LCD_SC|LCD_SD); |
106 | * if (j & byte) | 132 | * if (j & byte) |
107 | * QI(LCDR) |= LCD_SD; | 133 | * LCDR |= LCD_SD; |
108 | * QI(LCDR) |= LCD_SC|LCD_DS; | 134 | * LCDR |= LCD_SC|LCD_DS; |
109 | * } | 135 | * } |
110 | * while ((unsigned char)j >>= 1); | 136 | * while ((unsigned char)j >>= 1); |
111 | * else | 137 | * else |
112 | * do | 138 | * do |
113 | * { | 139 | * { |
114 | * QI(LCDR) &= ~(LCD_SC|LCD_SD|LCD_DS); | 140 | * LCDR &= ~(LCD_SC|LCD_SD|LCD_DS); |
115 | * if (j & byte) | 141 | * if (j & byte) |
116 | * QI(LCDR) |= LCD_SD; | 142 | * LCDR |= LCD_SD; |
117 | * QI(LCDR) |= LCD_SC; | 143 | * LCDR |= LCD_SC; |
118 | * } | 144 | * } |
119 | * while ((unsigned char)j >>= 1); | 145 | * while ((unsigned char)j >>= 1); |
120 | */ | 146 | */ |
121 | { | 147 | { |
122 | if (rs > 0) | 148 | if (data) |
123 | asm | 149 | asm ("shll8 %0\n" |
124 | ("shll8\t%0\n" | 150 | "0: \n\t" |
125 | "0:\n\t" | 151 | "and.b %2,@(r0,gbr)\n\t" |
126 | "and.b\t%2,@(r0,gbr)\n\t" | 152 | "shll %0\n\t" |
127 | "shll\t%0\n\t" | 153 | "bf 1f\n\t" |
128 | "bf\t1f\n\t" | 154 | "or.b %3,@(r0,gbr)\n" |
129 | "or.b\t%3,@(r0,gbr)\n" | 155 | "1: \n\t" |
130 | "1:\n\t" | 156 | "or.b %4,@(r0,gbr)\n" |
131 | "or.b\t%4,@(r0,gbr)\n" | 157 | "add #-1,%1\n\t" |
132 | "add\t#-1,%1\n\t" | 158 | "cmp/pl %1\n\t" |
133 | "cmp/pl\t%1\n\t" | 159 | "bt 0b" |
134 | "bt\t0b" | ||
135 | : | 160 | : |
136 | : /* %0 */ "r"(((unsigned)byte)<<16), | 161 | : /* %0 */ "r"(((unsigned)byte)<<16), |
137 | /* %1 */ "r"(8), | 162 | /* %1 */ "r"(8), |
@@ -161,7 +186,7 @@ static void lcd_byte (int byte,int rs) | |||
161 | /* %5 */ "z"(LCDR)); | 186 | /* %5 */ "z"(LCDR)); |
162 | } | 187 | } |
163 | 188 | ||
164 | void lcd_data (int data) | 189 | static void lcd_data (int data) |
165 | { | 190 | { |
166 | lcd_byte (data,1); | 191 | lcd_byte (data,1); |
167 | } | 192 | } |
@@ -200,30 +225,29 @@ static void lcd_goto (int x,int y) | |||
200 | 225 | ||
201 | static void lcd_toggle_backlight (void) | 226 | static void lcd_toggle_backlight (void) |
202 | { | 227 | { |
203 | PAIOR ^= LCD_BL; | 228 | PAIOR ^= LCD_BL; |
204 | } | 229 | } |
205 | 230 | ||
206 | static void lcd_turn_on_backlight (void) | 231 | static void lcd_turn_on_backlight (void) |
207 | { | 232 | { |
208 | PAIOR |= LCD_BL; | 233 | PAIOR |= LCD_BL; |
209 | } | 234 | } |
210 | 235 | ||
211 | static void lcd_turn_off_backlight (void) | 236 | static void lcd_turn_off_backlight (void) |
212 | { | 237 | { |
213 | PAIOR &= ~LCD_BL; | 238 | PAIOR &= ~LCD_BL; |
214 | } | 239 | } |
215 | 240 | ||
216 | /*** ICONS ***/ | 241 | /*** ICONS ***/ |
217 | #endif | 242 | #endif /* SIMULATOR */ |
218 | 243 | ||
219 | #ifdef HAVE_LCD_CHARCELLS | 244 | #ifdef HAVE_NEW_CHARCELL_LCD |
220 | # ifndef JBP_OLD | ||
221 | 245 | ||
222 | static char const lcd_ascii[] = | 246 | static char lcd_ascii[] = |
223 | { | 247 | { |
224 | /*****************************************************************************************/ | 248 | /*****************************************************************************/ |
225 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ | 249 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ |
226 | /* ************************************************************************************/ | 250 | /* ************************************************************************/ |
227 | /* 0x */ 0x00,0x01,0x02,0x03,0x00,0x00,0x00,0x00,0x04,0x05,0x00,0x00,0x00,0x00,0x00,0x00, | 251 | /* 0x */ 0x00,0x01,0x02,0x03,0x00,0x00,0x00,0x00,0x04,0x05,0x00,0x00,0x00,0x00,0x00,0x00, |
228 | /* 1x */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | 252 | /* 1x */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
229 | /* 2x */ 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, | 253 | /* 2x */ 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, |
@@ -240,16 +264,15 @@ static char const lcd_ascii[] = | |||
240 | /* Dx */ 0x44,0x4E,0x4F,0x4F,0x4F,0x4F,0x4F,0x20,0x20,0x55,0x55,0x55,0x55,0x59,0x20,0x20, | 264 | /* Dx */ 0x44,0x4E,0x4F,0x4F,0x4F,0x4F,0x4F,0x20,0x20,0x55,0x55,0x55,0x55,0x59,0x20,0x20, |
241 | /* Ex */ 0x61,0x61,0x61,0x61,0x61,0x61,0x20,0x63,0x65,0x65,0x65,0x65,0x69,0x69,0x69,0x69, | 265 | /* Ex */ 0x61,0x61,0x61,0x61,0x61,0x61,0x20,0x63,0x65,0x65,0x65,0x65,0x69,0x69,0x69,0x69, |
242 | /* Fx */ 0x64,0x6E,0x6F,0x6F,0x6F,0x6F,0x6F,0x20,0x20,0x75,0x75,0x75,0x75,0x79,0x79,0x79 | 266 | /* Fx */ 0x64,0x6E,0x6F,0x6F,0x6F,0x6F,0x6F,0x20,0x20,0x75,0x75,0x75,0x75,0x79,0x79,0x79 |
243 | /******/ | 267 | }; |
244 | }; | ||
245 | 268 | ||
246 | # else | 269 | #else |
247 | 270 | ||
248 | static char const lcd_ascii[] = | 271 | static char lcd_ascii[] = |
249 | { | 272 | { |
250 | /*****************************************************************************************/ | 273 | /*****************************************************************************/ |
251 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ | 274 | /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ |
252 | /* ************************************************************************************/ | 275 | /* ************************************************************************/ |
253 | /* 0x */ 0x00,0x01,0x02,0x03,0x00,0x00,0x00,0x00,0x85,0x89,0x00,0x00,0x00,0x00,0x00,0x00, | 276 | /* 0x */ 0x00,0x01,0x02,0x03,0x00,0x00,0x00,0x00,0x85,0x89,0x00,0x00,0x00,0x00,0x00,0x00, |
254 | /* 1x */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | 277 | /* 1x */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
255 | /* 2x */ 0x24,0x25,0x26,0x37,0x06,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33, | 278 | /* 2x */ 0x24,0x25,0x26,0x37,0x06,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33, |
@@ -266,18 +289,17 @@ static char const lcd_ascii[] = | |||
266 | /* Dx */ 0x48,0x52,0x53,0x53,0x53,0x53,0x53,0x24,0x24,0x59,0x59,0x59,0x59,0x5D,0x24,0x24, | 289 | /* Dx */ 0x48,0x52,0x53,0x53,0x53,0x53,0x53,0x24,0x24,0x59,0x59,0x59,0x59,0x5D,0x24,0x24, |
267 | /* Ex */ 0x65,0x65,0x65,0x65,0x65,0x65,0x24,0x67,0x69,0x69,0x69,0x69,0x6D,0x6D,0x6D,0x6D, | 290 | /* Ex */ 0x65,0x65,0x65,0x65,0x65,0x65,0x24,0x67,0x69,0x69,0x69,0x69,0x6D,0x6D,0x6D,0x6D, |
268 | /* Fx */ 0x73,0x72,0x73,0x73,0x73,0x73,0x73,0x24,0x24,0x79,0x79,0x79,0x79,0x7D,0x24,0x7D | 291 | /* Fx */ 0x73,0x72,0x73,0x73,0x73,0x73,0x73,0x24,0x24,0x79,0x79,0x79,0x79,0x7D,0x24,0x7D |
269 | /******/ | 292 | }; |
270 | }; | ||
271 | 293 | ||
272 | # endif | 294 | #endif |
273 | 295 | ||
274 | void lcd_puts (char const *string) | 296 | void lcd_puts(int x, int y, char *string) |
275 | { | 297 | { |
276 | while (*string) | 298 | while (*string) |
277 | lcd_data (LCD_ASCII(*string++)); | 299 | lcd_data (LCD_ASCII(*string++)); |
278 | } | 300 | } |
279 | 301 | ||
280 | void lcd_putns (char const *string,int n) | 302 | void lcd_putns (char *string,int n) |
281 | { | 303 | { |
282 | while (n--) | 304 | while (n--) |
283 | lcd_data (LCD_ASCII(*string++)); | 305 | lcd_data (LCD_ASCII(*string++)); |
@@ -288,7 +310,7 @@ void lcd_putc (int character) | |||
288 | lcd_data (LCD_ASCII(character)); | 310 | lcd_data (LCD_ASCII(character)); |
289 | } | 311 | } |
290 | 312 | ||
291 | void lcd_pattern (int which,char const *pattern,int count) | 313 | void lcd_pattern (int which,char *pattern,int count) |
292 | { | 314 | { |
293 | lcd_instruction (LCD_PRAM|which); | 315 | lcd_instruction (LCD_PRAM|which); |
294 | lcd_copy ((void *)pattern,count); | 316 | lcd_copy ((void *)pattern,count); |
@@ -310,8 +332,37 @@ void lcd_puthex (unsigned int value,int digits) | |||
310 | } | 332 | } |
311 | 333 | ||
312 | 334 | ||
313 | /* HAVE_LCD_CHARCELLS */ | 335 | #elif HAVE_LCD_BITMAP /* not CHARCELLS */ |
314 | #elif defined(HAVE_LCD_BITMAP) | 336 | |
337 | #define LCD_SD 1 // PB0 = 1 --- 0001 | ||
338 | #define LCD_SC 2 // PB1 = 1 --- 0010 | ||
339 | #define LCD_RS 4 // PB2 = 1 --- 0100 | ||
340 | #define LCD_CS 8 // PB3 = 1 --- 1000 | ||
341 | #define LCD_DS LCD_RS | ||
342 | |||
343 | #define LCD_SET_LOWER_COLUMN_ADDRESS ((char)0x00) | ||
344 | #define LCD_SET_HIGHER_COLUMN_ADDRESS ((char)0x10) | ||
345 | #define LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO ((char)0x20) | ||
346 | #define LCD_SET_POWER_CONTROL_REGISTER ((char)0x28) | ||
347 | #define LCD_SET_DISPLAY_START_LINE ((char)0x40) | ||
348 | #define LCD_SET_CONTRAST_CONTROL_REGISTER ((char)0x81) | ||
349 | #define LCD_SET_SEGMENT_REMAP ((char)0xA0) | ||
350 | #define LCD_SET_LCD_BIAS ((char)0xA2) | ||
351 | #define LCD_SET_ENTIRE_DISPLAY_OFF ((char)0xA4) | ||
352 | #define LCD_SET_ENTIRE_DISPLAY_ON ((char)0xA5) | ||
353 | #define LCD_SET_NORMAL_DISPLAY ((char)0xA6) | ||
354 | #define LCD_SET_REVERSE_DISPLAY ((char)0xA7) | ||
355 | #define LCD_SET_INDICATOR_OFF ((char)0xAC) | ||
356 | #define LCD_SET_INDICATOR_ON ((char)0xAD) | ||
357 | #define LCD_SET_DISPLAY_OFF ((char)0xAE) | ||
358 | #define LCD_SET_DISPLAY_ON ((char)0xAF) | ||
359 | #define LCD_SET_PAGE_ADDRESS ((char)0xB0) | ||
360 | #define LCD_SET_COM_OUTPUT_SCAN_DIRECTION ((char)0xC0) | ||
361 | #define LCD_SET_DISPLAY_OFFSET ((char)0xD3) | ||
362 | #define LCD_SET_READ_MODIFY_WRITE_MODE ((char)0xE0) | ||
363 | #define LCD_SOFTWARE_RESET ((char)0xE2) | ||
364 | #define LCD_NOP ((char)0xE3) | ||
365 | #define LCD_SET_END_OF_READ_MODIFY_WRITE_MODE ((char)0xEE) | ||
315 | 366 | ||
316 | /* | 367 | /* |
317 | * All bitmaps have this format: | 368 | * All bitmaps have this format: |
@@ -668,7 +719,6 @@ void lcd_clearpixel(int x, int y) | |||
668 | CLEAR_PIXEL(x,y); | 719 | CLEAR_PIXEL(x,y); |
669 | } | 720 | } |
670 | 721 | ||
671 | |||
672 | #else | 722 | #else |
673 | /* no LCD defined, no code to use */ | 723 | /* no LCD defined, no code to use */ |
674 | #endif | 724 | #endif |
diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h index dcfa1d587e..c196a18b63 100644 --- a/firmware/drivers/lcd.h +++ b/firmware/drivers/lcd.h | |||
@@ -24,31 +24,7 @@ | |||
24 | #include "types.h" | 24 | #include "types.h" |
25 | #include "config.h" | 25 | #include "config.h" |
26 | 26 | ||
27 | #define LCDR (PBDR+1) | ||
28 | |||
29 | /* PA14 : /LCD-BL --- backlight */ | ||
30 | #define LCD_BL (14-8) | ||
31 | |||
32 | #ifdef HAVE_LCD_CHARCELLS | 27 | #ifdef HAVE_LCD_CHARCELLS |
33 | /* JukeBox MP3 Player - AJB6K, AJBS20 */ | ||
34 | # define LCD_DS +1 // PB0 = 1 --- 0001 --- LCD-DS | ||
35 | # define LCD_CS +2 // PB1 = 1 --- 0010 --- /LCD-CS | ||
36 | # define LCD_SD +4 // PB2 = 1 --- 0100 --- LCD-SD | ||
37 | # define LCD_SC +8 // PB3 = 1 --- 1000 --- LCD-SC | ||
38 | # ifndef JBP_OLD | ||
39 | # define LCD_CONTRAST_SET ((char)0x50) | ||
40 | # define LCD_CRAM ((char)0x80) /* Characters */ | ||
41 | # define LCD_PRAM ((char)0xC0) /* Patterns */ | ||
42 | # define LCD_IRAM ((char)0x40) /* Icons */ | ||
43 | # else | ||
44 | # define LCD_CONTRAST_SET ((char)0xA8) | ||
45 | # define LCD_CRAM ((char)0xB0) /* Characters */ | ||
46 | # define LCD_PRAM ((char)0x80) /* Patterns */ | ||
47 | # define LCD_IRAM ((char)0xE0) /* Icons */ | ||
48 | # endif | ||
49 | # define LCD_ASCII(c) (lcd_ascii[(c)&255]) | ||
50 | # define LCD_CURSOR(x,y) ((char)(LCD_CRAM+((y)*16+(x)))) | ||
51 | # define LCD_ICON(i) ((char)(LCD_IRAM+i)) | ||
52 | # define LCD_ICON_BATTERY 0 | 28 | # define LCD_ICON_BATTERY 0 |
53 | # define LCD_BATTERY_FRAME 0x02 | 29 | # define LCD_BATTERY_FRAME 0x02 |
54 | # define LCD_BATTERY_BAR1 0x08 | 30 | # define LCD_BATTERY_BAR1 0x08 |
@@ -78,85 +54,30 @@ | |||
78 | # define LCD_VOLUME_BAR5 0x01 | 54 | # define LCD_VOLUME_BAR5 0x01 |
79 | # define LCD_ICON_PARAM 10 | 55 | # define LCD_ICON_PARAM 10 |
80 | # define LCD_PARAM_SYMBOL 0xF0 | 56 | # define LCD_PARAM_SYMBOL 0xF0 |
81 | #endif | ||
82 | |||
83 | #ifdef HAVE_LCD_BITMAP | ||
84 | /* JukeBox MP3 Recorder - AJBR --- FIXME */ | ||
85 | |||
86 | /* Defines from Alan on IRC, April 11th 2002 */ | ||
87 | #define LCD_SD +1 // PB0 = 1 --- 0001 | ||
88 | #define LCD_SC +2 // PB1 = 1 --- 0010 | ||
89 | #define LCD_RS +4 // PB2 = 1 --- 0100 | ||
90 | #define LCD_CS +8 // PB3 = 1 --- 1000 | ||
91 | |||
92 | #define LCD_DS LCD_RS | ||
93 | |||
94 | #define LCD_SET_LOWER_COLUMN_ADDRESS ((char)0x00) | ||
95 | #define LCD_SET_HIGHER_COLUMN_ADDRESS ((char)0x10) | ||
96 | #define LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO ((char)0x20) | ||
97 | #define LCD_SET_POWER_CONTROL_REGISTER ((char)0x28) | ||
98 | #define LCD_SET_DISPLAY_START_LINE ((char)0x40) | ||
99 | #define LCD_SET_CONTRAST_CONTROL_REGISTER ((char)0x81) | ||
100 | #define LCD_SET_SEGMENT_REMAP ((char)0xA0) | ||
101 | #define LCD_SET_LCD_BIAS ((char)0xA2) | ||
102 | #define LCD_SET_ENTIRE_DISPLAY_OFF ((char)0xA4) | ||
103 | #define LCD_SET_ENTIRE_DISPLAY_ON ((char)0xA5) | ||
104 | #define LCD_SET_NORMAL_DISPLAY ((char)0xA6) | ||
105 | #define LCD_SET_REVERSE_DISPLAY ((char)0xA7) | ||
106 | #define LCD_SET_INDICATOR_OFF ((char)0xAC) | ||
107 | #define LCD_SET_INDICATOR_ON ((char)0xAD) | ||
108 | #define LCD_SET_DISPLAY_OFF ((char)0xAE) | ||
109 | #define LCD_SET_DISPLAY_ON ((char)0xAF) | ||
110 | #define LCD_SET_PAGE_ADDRESS ((char)0xB0) | ||
111 | #define LCD_SET_COM_OUTPUT_SCAN_DIRECTION ((char)0xC0) | ||
112 | #define LCD_SET_DISPLAY_OFFSET ((char)0xD3) | ||
113 | #define LCD_SET_READ_MODIFY_WRITE_MODE ((char)0xE0) | ||
114 | #define LCD_SOFTWARE_RESET ((char)0xE2) | ||
115 | #define LCD_NOP ((char)0xE3) | ||
116 | #define LCD_SET_END_OF_READ_MODIFY_WRITE_MODE ((char)0xEE) | ||
117 | |||
118 | |||
119 | #define DISP_X 112 | ||
120 | #define DISP_Y 64 | ||
121 | |||
122 | #define LCD_WIDTH DISP_X /* Display width in pixels */ | ||
123 | #define LCD_HEIGHT DISP_Y /* Display height in pixels */ | ||
124 | 57 | ||
125 | void lcd_init (void); | 58 | extern void lcd_puts(int x, int y, char *string); |
126 | void lcd_update (void); | ||
127 | void lcd_clear_display (void); | ||
128 | void lcd_position (int x, int y, int size); | ||
129 | void lcd_string (const char *str); | ||
130 | void lcd_bitmap (const unsigned char *src, int x, int y, int nx, int ny, | ||
131 | bool clear); | ||
132 | void lcd_clearrect (int x, int y, int nx, int ny); | ||
133 | void lcd_fillrect (int x, int y, int nx, int ny); | ||
134 | void lcd_invertrect (int x, int y, int nx, int ny); | ||
135 | void lcd_drawline( int x1, int y1, int x2, int y2 ); | ||
136 | void lcd_drawpixel(int x, int y); | ||
137 | void lcd_clearpixel(int x, int y); | ||
138 | #endif | ||
139 | |||
140 | |||
141 | #ifndef SIMULATOR | ||
142 | |||
143 | extern void lcd_data (int data); | ||
144 | extern void lcd_instruction (int instruction); | ||
145 | extern void lcd_zero (int length); | ||
146 | extern void lcd_fill (int data,int length); | ||
147 | extern void lcd_copy (void *data,int count); | ||
148 | |||
149 | #ifdef HAVE_LCD_CHARCELLS | ||
150 | |||
151 | extern void lcd_puts (char const *string); | ||
152 | extern void lcd_putns (char const *string,int n); | ||
153 | extern void lcd_putc (int character); | ||
154 | extern void lcd_puthex (unsigned int value,int digits); | 59 | extern void lcd_puthex (unsigned int value,int digits); |
155 | 60 | extern void lcd_pattern (int which,char *pattern,int count); | |
156 | extern void lcd_pattern (int which,char const *pattern,int count); | 61 | |
157 | 62 | #elif HAVE_LCD_BITMAP | |
158 | #endif /* HAVE_LCD_CHARCELLS */ | 63 | |
159 | 64 | #define LCD_WIDTH 112 /* Display width in pixels */ | |
160 | #endif /* SIMULATOR */ | 65 | #define LCD_HEIGHT 64 /* Display height in pixels */ |
66 | |||
67 | extern void lcd_init (void); | ||
68 | extern void lcd_update (void); | ||
69 | extern void lcd_clear_display (void); | ||
70 | extern void lcd_position (int x, int y, int size); | ||
71 | extern void lcd_string (char *str); | ||
72 | extern void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, | ||
73 | bool clear); | ||
74 | extern void lcd_clearrect (int x, int y, int nx, int ny); | ||
75 | extern void lcd_fillrect (int x, int y, int nx, int ny); | ||
76 | extern void lcd_invertrect (int x, int y, int nx, int ny); | ||
77 | extern void lcd_drawline( int x1, int y1, int x2, int y2 ); | ||
78 | extern void lcd_drawpixel(int x, int y); | ||
79 | extern void lcd_clearpixel(int x, int y); | ||
80 | |||
81 | #endif /* CHARCELLS / BITMAP */ | ||
161 | 82 | ||
162 | #endif /* __LCD_H__ */ | 83 | #endif /* __LCD_H__ */ |