a few readability changes to hd44780-charmap.h;

new file CFontz-charmap.h used in CFontzPacket.c for all models except CF633
to adapt the CrystalFontz icharacter codes better to ASCII / ISO-8859-1
This commit is contained in:
marschap
2005-06-04 22:07:37 +00:00
parent deea25e6ea
commit 3046d92ae9
4 changed files with 168 additions and 92 deletions
+63
View File
@@ -0,0 +1,63 @@
/*
* Character mapping for CFontz 63x by Peter Marschall <peter@adpm.de>
*
* Translates ISO 8859-1 to CFontz 63x charset (not for CF633).
*
* This file is released under the GNU General Public License.
* Refer to the COPYING file distributed with this package.
*
* The following translations are being performed:
* - mas umlaut characters to the corresponding umlaut characters
* - map other accented characters to the corresponding accented characters
* - map unmappable accented characters to their base characters
* - map beta (=sharp s), micro and various currency symbols
* - back-quote simulated by single quote
* - diaeresis simulated by double quote
* - degree simulated by superscript zero
* - multiplication sign simulated by x
* - division sign simulated by :
*
*/
const unsigned char CFontz_charmap[] = { // mapped chars: ? means ToDo
/* #0 */
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
/* #32 */
32, 33, 34, 35, 162, 37, 38, 39, // $
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
/* #64 */
160, 65, 66, 67, 68, 69, 70, 71, // @
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 250, 251, 252, 29, 196, // [ \ ] ^ _
/* #96 */
39, 97, 98, 99, 100, 101, 102, 103, // `
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 253, 254, 255, 206, 32, // { | } ~ DEL
/* #128 */
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159,
/* #160 */
32, 64, 177, 161, 36, 163, 254, 95, // SPC ¡ ¢ £ CURR ¥ | §
34, 169, 170, 20, 172, 173, 174, 175, // " ? ? « ? ? ? ?
128, 140, 130, 131, 180, 143, 182, 222, // ° ± ² ³ ? µ ? ·
184, 129, 186, 21, 139, 138, 190, 96, // ? ¹ ? » 1/4 1/2 ? ¿
/* #192 */
65, 226, 65, 65, 91, 174, 188, 169, // À Á Â Ã Ä Å Æ Ç
197, 191, 198, 69, 73, 227, 73, 73, // È É Ê Ë Ì Í Î Ï
68, 93, 79, 228, 236, 79, 92, 120, // Ð Ñ Ò Ó Ô Õ Ö ×
171, 85, 229, 85, 94, 230, 222, 190, // Ø Ù Ú Û Ü Ý ? ß
/* #224 */
127, 231, 97, 97, 123, 175, 189, 200, // à á â ã ä å æ ç
164, 165, 199, 101, 167, 232, 105, 105, // è é ê ë ì í î ï
240, 125, 168, 233, 237, 111, 124, 58, // ? ñ ò ó ô õ ö ÷
172, 166, 234, 117, 126, 235, 254, 121 // ø ù ú û ü ý ? ÿ
};
+53 -8
View File
@@ -81,6 +81,7 @@
#include "CFontz633io.h"
#include "report.h"
#include "lcd_lib.h"
#include "CFontz-charmap.h"
#define CF633_KEY_UP 1
#define CF633_KEY_DOWN 2
@@ -599,6 +600,24 @@ CFontz633_chr (Driver *drvthis, int x, int y, char c)
y--;
x--;
p->framebuf[(y * p->width) + x] = (p->model == 633)
? c
: CFontz_charmap[(unsigned) c];
}
/*
* Prints a character on the lcd display, at position (x,y).
* The upper-left is (1,1), and the lower right should be (16,2).
*/
static void
CFontz633_raw_chr (Driver *drvthis, int x, int y, unsigned char c)
{
PrivateData *p = drvthis->private_data;
y--;
x--;
p->framebuf[(y * p->width) + x] = c;
}
@@ -1105,7 +1124,7 @@ CFontz633_icon (Driver *drvthis, int x, int y, int icon)
if (p->model == 633)
CFontz633_chr(drvthis, x, y, 255);
else
CFontz633_chr(drvthis, x, y, 31);
CFontz633_raw_chr(drvthis, x, y, 31);
break;
case ICON_HEART_FILLED:
CFontz633_set_char(drvthis, 0, icons[1]);
@@ -1116,18 +1135,32 @@ CFontz633_icon (Driver *drvthis, int x, int y, int icon)
CFontz633_chr(drvthis, x, y, 0);
break;
case ICON_ARROW_UP:
CFontz633_set_char(drvthis, 1, icons[2]);
CFontz633_chr(drvthis, x, y, 1);
if (p->model == 633) {
CFontz633_set_char(drvthis, 1, icons[2]);
CFontz633_chr(drvthis, x, y, 1);
}
else
CFontz633_raw_chr(drvthis, x, y, 0xDE);
break;
case ICON_ARROW_DOWN:
CFontz633_set_char(drvthis, 2, icons[3]);
CFontz633_chr(drvthis, x, y, 2);
if (p->model == 633) {
CFontz633_set_char(drvthis, 2, icons[3]);
CFontz633_chr(drvthis, x, y, 2);
}
else
CFontz633_raw_chr(drvthis, x, y, 0xE0);
break;
case ICON_ARROW_LEFT:
CFontz633_chr(drvthis, x, y, 0x7F);
if (p->model == 633)
CFontz633_raw_chr(drvthis, x, y, 0x7F);
else
CFontz633_raw_chr(drvthis, x, y, 0xE1);
break;
case ICON_ARROW_RIGHT:
CFontz633_chr(drvthis, x, y, 0x7E);
if (p->model == 633)
CFontz633_raw_chr(drvthis, x, y, 0x7E);
else
CFontz633_raw_chr(drvthis, x, y, 0xDF);
break;
case ICON_CHECKBOX_OFF:
CFontz633_set_char(drvthis, 3, icons[4]);
@@ -1141,6 +1174,16 @@ CFontz633_icon (Driver *drvthis, int x, int y, int icon)
CFontz633_set_char(drvthis, 5, icons[6]);
CFontz633_chr(drvthis, x, y, 5);
break;
case ICON_SELECTOR_AT_LEFT:
if (p->model == 633)
return -1;
CFontz633_raw_chr(drvthis, x, y, 0x10);
break;
case ICON_SELECTOR_AT_RIGHT:
if (p->model == 633)
return -1;
CFontz633_raw_chr(drvthis, x, y, 0x11);
break;
default:
return -1; /* Let the core do other icons */
}
@@ -1191,7 +1234,9 @@ CFontz633_string (Driver *drvthis, int x, int y, char string[])
/* Check for buffer overflows... */
if ((y * p->width) + x + i > (p->width * p->height))
break;
p->framebuf[(y * p->width) + x + i] = string[i];
p->framebuf[(y * p->width) + x + i] = (p->model == 633)
? c
: CFontz_charmap[(unsigned) string[i]];
}
}
+2 -2
View File
@@ -44,8 +44,8 @@ imon_LDADD = libLCD.a
libLCD_a_SOURCES = lcd_lib.h lcd_lib.c
bayrad_SOURCES = lcd.h bayrad.h bayrad.c report.h
CFontz_SOURCES = lcd.h CFontz.c CFontz.h report.h
CFontz633_SOURCES = lcd.h CFontz633.c CFontz633.h CFontz633io.c CFontz633io.h report.h
CFontz_SOURCES = lcd.h CFontz.c CFontz.h CFontz-charmap.h report.h
CFontz633_SOURCES = lcd.h CFontz633.c CFontz633.h CFontz-charmap.h CFontz633io.c CFontz633io.h report.h
curses_SOURCES = lcd.h curses_drv.h curses_drv.c report.h
glk_SOURCES = lcd.h glk.c glk.h glkproto.c glkproto.h report.h
hd44780_SOURCES = lcd.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h report.h
+50 -82
View File
@@ -7,93 +7,61 @@
* Initial table taken from lcd.o Linux kernel driver by
* Nils Faerber <nilsf@users.sourceforge.net>. Thanks!
*
* This file is released under the GNU General Public License. Refer to the
* COPYING file distributed with this package.
* This file is released under the GNU General Public License.
* Refer to the COPYING file distributed with this package.
*
*
* Following translations are being performed:
* - maps umlaut accent characters to the corresponding umlaut characters
* - maps other accent characters to the characters without accents
* - maps beta (=ringel-S), micro and Yen
* The following translations are being performed:
* - map umlaut accent characters to the corresponding umlaut characters
* - map other accent characters to the characters without accents
* - map beta (=sharp s), micro and Yen
*
* Alternative mappings:
* - #112 ("p") -> #240 (large "p"), orig. mapped -> #112
* - #113 ("q") -> #241 (large "q"), orig. mapped -> #113
* - #112 ("p") -> #240 (large "p"), orig. mapped -> #112
* - #113 ("q") -> #241 (large "q"), orig. mapped -> #113
*
* HD44780 misses backslash
*
*/
const char HD44780_charmap[]={
/* #0 */
0, 1, 2, 3,
4, 5, 6, 7,
8, 9, 10, 11,
12, 13, 14, 15,
16, 17, 18, 19,
20, 21, 22, 23,
24, 25, 26, 27,
28, 29, 30, 31,
/* #32 */
32, 33, 34, 35,
36, 37, 38, 39,
40, 41, 42, 43,
44, 45, 46, 47,
48, 49, 50, 51,
52, 53, 54, 55,
56, 57, 58, 59,
60, 61, 62, 63,
/* #64 */
64, 65, 66, 67,
68, 69, 70, 71,
72, 73, 74, 75,
76, 77, 78, 79,
80, 81, 82, 83,
84, 85, 86, 87,
88, 89, 90, 91,
/* #92 */
47, 93, 94, 95,
96, 97, 98, 99,
100,101,102,103,
104,105,106,107,
108,109,110,111,
112,113,114,115,
116,117,118,119,
120,121,122,123,
124,125,126,127,
/* #128 */
128,129,130,131,
132,133,134,135,
136,137,138,139,
140,141,142,143,
144,145,146,147,
148,149,150,151,
152,153,154,155,
156,157,158,159,
/* #160 */
160, 33,236,237,
164, 92,124,167,
34,169,170,171,
172,173,174,175,
223,177,178,179,
39,249,247,165,
44,185,186,187,
188,189,190, 63,
/* #192 */
65, 65, 65, 65,
225, 65, 65, 67,
69, 69, 69, 69,
73, 73, 73, 73,
68, 78, 79, 79,
79, 79,239,120,
48, 85, 85, 85,
245, 89,240,226,
/* #224 */
97, 97, 97, 97,
225, 97, 97, 99,
101,101,101,101,
105,105,105,105,
111,110,111,111,
111,111,239,253,
48,117,117,117,
245,121,240,255};
const unsigned char HD44780_charmap[] = {
/* #0 */
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
/* #32 */
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
/* #64 */
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 47, 93, 94, 95,
/* #96 */
96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127,
/* #128 */
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159,
/* #160 */
160, 33, 236, 237, 164, 92, 124, 167,
34, 169, 170, 171, 172, 173, 174, 175,
223, 177, 178, 179, 39, 249, 247, 165,
44, 185, 186, 187, 188, 189, 190, 63,
/* #192 */
65, 65, 65, 65, 225, 65, 65, 67,
69, 69, 69, 69, 73, 73, 73, 73,
68, 78, 79, 79, 79, 79, 239, 120,
48, 85, 85, 85, 245, 89, 240, 226,
/* #224 */
97, 97, 97, 97, 225, 97, 97, 99,
101, 101, 101, 101, 105, 105, 105, 105,
111, 110, 111, 111, 111, 111, 239, 253,
48, 117, 117, 117, 245, 121, 240, 255
};