Change icon handling and charmaps:

* The full block icon now has index 0 and the heart has index 7. This makes
  the full block work if vBar custom chars are loaded (which use index 1-7).
* Prevent (hbar, vbar, bignum) modes from overwriting custom chars (except
  full block).
* Prevent the heartbeat from overwriting custom chars in vbar and bignum mode.
* Make the driver point to 0x1A and 0x1B characters for right/left arrow
  characters (those are the codes from HD44780 A02) and make all charmaps
  pointing to the correct characters.
* It is now possible to map the tilde character.
* Update other drivers that use hd44780-charmap.h (IOWarrior and ula200).
* Replace characters using charmaps on input instead of output!
* Remove some unnecessary comments.
This commit is contained in:
mmdolze
2011-11-15 21:40:23 +00:00
parent 438788e157
commit 77bf952dd2
7 changed files with 84 additions and 105 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ Known Bugs:
V0.5dev:
- If vBars are used together with ICON_BLOCK_FILLED on the same screen and
that icon is implemented as a custom char, it sometimes is replaced with
a non full block from the vBar.
a non full block from the vBar. Affected drivers: IOWarrior, CwLinux
- On Solaris the mtc_s16209x driver fails to compile. Configure LCDproc to
exclude this driver.
- On FreeBSD drivers using the pthread library are known not to work.
+1
View File
@@ -13,6 +13,7 @@ v0.5dev (ongoing development)
* hd44780/serial: Change backlight handling (see commit message)
+ glcd driver: Add FreeType 2 rendering support (B. Walle and M. Dolze)
+ glcd driver: New connection type PNG, writes framebuffer as PNG image
+ hd44780: Fix vBars and block icon not working correctly on the same screen
v0.5.5
+ sed1330 driver: Add support for HG25504 (L. Lagendijk)
+2 -2
View File
@@ -1044,10 +1044,10 @@ static unsigned char block_filled[] =
IOWarrior_chr(drvthis, x, y, 2);
break;
case ICON_ARROW_LEFT:
IOWarrior_chr(drvthis, x, y, 0x7F);
IOWarrior_chr(drvthis, x, y, 0x1B);
break;
case ICON_ARROW_RIGHT:
IOWarrior_chr(drvthis, x, y, 0x7E);
IOWarrior_chr(drvthis, x, y, 0x1A);
break;
case ICON_CHECKBOX_OFF:
IOWarrior_set_char(drvthis, 3, checkbox_off);
+15 -7
View File
@@ -1,6 +1,13 @@
/** \file server/drivers/hd44780-charmap.h
* Character mapping for HD44780 devices. Translates ISO 8859-1 to known
* HD44780 (and compatible) ROM character sets.
*
* \note All supported display controllers have their custom characters
* available as codes 0x00 (0) to 0x0F (15). Theses character codes
* MUST NOT be mapped.
* \note By convention drivers (hd44780, IOWarrior, ula200) use codes
* 0x1A (26) and 0x1B (27) to access left and right arrow characters.
* Map these to the corresponding characters of the controller CGROM.
*/
/*-
@@ -13,6 +20,7 @@
* Refer to the COPYING file distributed with this package.
*/
/*
* The 'none' charmap does map each character to itself, not replacing
* anything. Most useful for testing purpose.
@@ -72,7 +80,7 @@ const unsigned char none_charmap[] = {
* - map beta (=sharp s), micro and Yen
* - map 'n/N with tilde' to 'n with bar above'
*
* HD44780 misses backslash
* HD44780 misses backslash and tilde
*
*/
const unsigned char HD44780_charmap[] = {
@@ -80,7 +88,7 @@ const unsigned char HD44780_charmap[] = {
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,
24, 25, 126, 127, 28, 29, 30, 31,
/* #32 */
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
@@ -195,7 +203,7 @@ const unsigned char EA_KS0073_charmap[] = {
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,
24, 25, 223, 225, 28, 29, 30, 31,
/* #32 */
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
@@ -210,7 +218,7 @@ const unsigned char EA_KS0073_charmap[] = {
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, 218, 255, 223, 225,
120, 121, 122, 253, 218, 255, 206, 127,
/* #128 */
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 140, 141, 142,
@@ -241,7 +249,7 @@ const unsigned char SED1278F_0B_charmap[] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 32, 32, 32, 32, 32, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
24, 25, 199, 200, 28, 29, 30, 31,
/* #32 */
32, 33, 39, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
@@ -444,7 +452,7 @@ const unsigned char uPD16314_charmap[] = {
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,
24, 25, 126, 127, 28, 29, 30, 31,
/* 20h - 3Fh : Numbers and punctuation */
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
@@ -458,7 +466,7 @@ const unsigned char uPD16314_charmap[] = {
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, 142, 127,
120, 121, 122, 123, 124, 125, 142, 32,
/* 80h - 9Fh : Control characters */
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
+60 -90
View File
@@ -688,8 +688,7 @@ HD44780_flush(Driver *drvthis)
drawing = 1;
HD44780_position(drvthis,x,y);
}
p->hd44780_functions->senddata(p, dispID, RS_DATA,
available_charmaps[p->charmap].charmap[*sp]);
p->hd44780_functions->senddata(p, dispID, RS_DATA, *sp);
p->hd44780_functions->uPause(p, 40); /* Minimum exec time for all commands */
*sq = *sp; /* Update backing store */
count++;
@@ -754,7 +753,8 @@ HD44780_chr(Driver *drvthis, int x, int y, char ch)
x--;
if ((x >= 0) && (y >= 0) && (x < p->width) && (y < p->height))
p->framebuf[(y * p->width) + x] = ch;
p->framebuf[(y * p->width) + x] =
available_charmaps[p->charmap].charmap[(unsigned char) ch];
}
@@ -780,7 +780,8 @@ HD44780_string(Driver *drvthis, int x, int y, const char string[])
for (i = 0; (string[i] != '\0') && (x < p->width); i++, x++) {
if (x >= 0) /* no write left of left border */
p->framebuf[(y * p->width) + x] = string[i];
p->framebuf[(y * p->width) + x] =
available_charmaps[p->charmap].charmap[(unsigned char) string[i]];
}
}
@@ -909,15 +910,6 @@ HD44780_vbar(Driver *drvthis, int x, int y, int len, int promille, int options)
{
PrivateData *p = (PrivateData *) drvthis->private_data;
/*
* x and y are the start position of the bar.
* The bar by default grows in the 'up' direction
* (other direction not yet implemented).
* len is the number of characters that the bar is long at 100%
* promille is the number of promilles (0..1000) that the bar should
* be filled.
*/
if (p->ccmode != vbar) {
unsigned char vBar[p->cellheight];
int i;
@@ -957,14 +949,6 @@ HD44780_hbar(Driver *drvthis, int x, int y, int len, int promille, int options)
{
PrivateData *p = (PrivateData *) drvthis->private_data;
/*
* x and y are the start position of the bar.
* The bar by default grows in the 'right' direction
* (other direction not yet implemented).
* len is the number of characters that the bar is long at 100%
* promille is the number of promilles (0..1000) that the bar should be filled.
*/
if (p->ccmode != hbar) {
unsigned char hBar[p->cellheight];
int i;
@@ -973,7 +957,7 @@ HD44780_hbar(Driver *drvthis, int x, int y, int len, int promille, int options)
/* Not supported(yet) */
report(RPT_WARNING, "%s: hbar: cannot combine two modes using user-defined characters",
drvthis->name);
return;
return;
}
p->ccmode = hbar;
@@ -1062,7 +1046,7 @@ HD44780_set_char(Driver *drvthis, int n, unsigned char *dat)
letter = dat[row] & mask;
if (p->cc[n].cache[row] != letter)
p->cc[n].clean = 0; /* only mark dirty if really different */
p->cc[n].clean = 0; /* only mark dirty if really different */
p->cc[n].cache[row] = letter;
}
}
@@ -1080,6 +1064,8 @@ HD44780_set_char(Driver *drvthis, int n, unsigned char *dat)
MODULE_EXPORT int
HD44780_icon(Driver *drvthis, int x, int y, int icon)
{
PrivateData *p = (PrivateData *) drvthis->private_data;
static unsigned char heart_open[] =
{ b__XXXXX,
b__X_X_X,
@@ -1116,26 +1102,6 @@ HD44780_icon(Driver *drvthis, int x, int y, int icon)
b___XXX_,
b____X__,
b_______ };
/*-
static unsigned char arrow_left[] =
{ b_______,
b____X__,
b___X___,
b__XXXXX,
b___X___,
b____X__,
b_______,
b_______ };
static unsigned char arrow_right[] =
{ b_______,
b____X__,
b_____X_,
b__XXXXX,
b_____X_,
b____X__,
b_______,
b_______ };
*/
static unsigned char checkbox_off[] =
{ b_______,
b_______,
@@ -1163,35 +1129,6 @@ HD44780_icon(Driver *drvthis, int x, int y, int icon)
b__X_X_X,
b__XXXXX,
b_______ };
/*-
static unsigned char selector_left[] =
{ b___X___,
b___XX__,
b___XXX_,
b___XXXX,
b___XXX_,
b___XX__,
b___X___,
b_______ };
static unsigned char selector_right[] =
{ b_____X_,
b____XX_,
b___XXX_,
b__XXXX_,
b___XXX_,
b____XX_,
b_____X_,
b_______ };
static unsigned char ellipsis[] =
{ b_______,
b_______,
b_______,
b_______,
b_______,
b_______,
b__X_X_X,
b_______ };
*/
static unsigned char block_filled[] =
{ b__XXXXX,
b__XXXXX,
@@ -1202,20 +1139,59 @@ HD44780_icon(Driver *drvthis, int x, int y, int icon)
b__XXXXX,
b__XXXXX };
/* Yes I know, this is a VERY BAD implementation */
/* Icons from CGROM will always work */
switch (icon) {
case ICON_BLOCK_FILLED:
HD44780_set_char(drvthis, 6, block_filled);
HD44780_chr(drvthis, x, y, 6);
break;
case ICON_HEART_FILLED:
HD44780_set_char(drvthis, 0, heart_filled);
case ICON_ARROW_LEFT:
HD44780_chr(drvthis, x, y, 0x1B);
return 0;
case ICON_ARROW_RIGHT:
HD44780_chr(drvthis, x, y, 0x1A);
return 0;
}
/* The full block works except if ccmode=bignum */
if (icon == ICON_BLOCK_FILLED) {
if (p->ccmode != bignum) {
HD44780_set_char(drvthis, 0, block_filled);
HD44780_chr(drvthis, x, y, 0);
break;
case ICON_HEART_OPEN:
HD44780_set_char(drvthis, 0, heart_open);
HD44780_chr(drvthis, x, y, 0);
break;
return 0;
}
else {
return -1;
}
}
/* The heartbeat icons do not work in bignum and vbar mode */
if ((icon == ICON_HEART_FILLED) || (icon == ICON_HEART_OPEN)) {
if ((p->ccmode != bignum) && (p->ccmode != vbar)) {
switch (icon) {
case ICON_HEART_FILLED:
HD44780_set_char(drvthis, 7, heart_filled);
HD44780_chr(drvthis, x, y, 7);
return 0;
case ICON_HEART_OPEN:
HD44780_set_char(drvthis, 7, heart_open);
HD44780_chr(drvthis, x, y, 7);
return 0;
}
}
else {
return -1;
}
}
/* All other icons work only in the standard or icon ccmode */
if (p->ccmode != icons) {
if (p->ccmode != standard) {
/* Not supported (yet) */
report(RPT_WARNING, "%s: num: cannot combine two modes using user-defined characters",
drvthis->name);
return -1;
}
p->ccmode = icons;
}
switch (icon) {
case ICON_ARROW_UP:
HD44780_set_char(drvthis, 1, arrow_up);
HD44780_chr(drvthis, x, y, 1);
@@ -1224,12 +1200,6 @@ HD44780_icon(Driver *drvthis, int x, int y, int icon)
HD44780_set_char(drvthis, 2, arrow_down);
HD44780_chr(drvthis, x, y, 2);
break;
case ICON_ARROW_LEFT:
HD44780_chr(drvthis, x, y, 0x7F);
break;
case ICON_ARROW_RIGHT:
HD44780_chr(drvthis, x, y, 0x7E);
break;
case ICON_CHECKBOX_OFF:
HD44780_set_char(drvthis, 3, checkbox_off);
HD44780_chr(drvthis, x, y, 3);
+2 -2
View File
@@ -107,12 +107,12 @@
/* Type of characters currently stored in CGRAM. */
typedef enum {
standard, /* only char 0 is used for heartbeat */
standard, /* one char is used for heartbeat */
vbar, /* vertical bars */
hbar, /* horizontal bars */
icons, /* standard icons */
custom, /* custom settings */
bignum, /* big numbers */
bigchar /* big characters */
} CGmode;
/* What does the shared module handle look like on the current platform? */
+3 -3
View File
@@ -33,10 +33,10 @@
#include <usb.h>
#include <ftdi.h>
#include "hd44780-charmap.h"
#include "lcd.h"
#include "ula200.h"
#include "report.h"
#include "hd44780-charmap.h"
#include "adv_bignum.h"
@@ -880,10 +880,10 @@ ula200_icon(Driver *drvthis, int x, int y, int icon)
ula200_chr(drvthis, x, y, 4);
break;
case ICON_ARROW_LEFT:
ula200_chr(drvthis, x, y, 0x7F);
ula200_chr(drvthis, x, y, 0x1B);
break;
case ICON_ARROW_RIGHT:
ula200_chr(drvthis, x, y, 0x7E);
ula200_chr(drvthis, x, y, 0x1A);
break;
case ICON_CHECKBOX_OFF:
ula200_chr(drvthis, x, y, 5);