From 739fee1ec8032f6b9f12dd937e3974a36792049d Mon Sep 17 00:00:00 2001 From: mmdolze Date: Sun, 27 Feb 2011 12:46:44 +0000 Subject: [PATCH] Convert i2500vfd and mdm166a driver to use 8 byte bitmap custom character and but the character definitions for heartbeat into the font. --- ChangeLog | 1 + server/drivers/i2500vfd.c | 36 +++++------------------------- server/drivers/i2500vfdfm.c | 16 ++++++++++++++ server/drivers/mdm166a.c | 44 ++++++++----------------------------- 4 files changed, 31 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index e17040b..6f79bab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ v.0.5dev (ongoing development) * CFontzPacket: Fix not using select() even if its available * CFontzPacket: Use cellwidth = 5 on CFA-631 and CFA-635 too * t6963: Convert font to 8 byte bitmap + * convert i2500vfd and mdm166a driver to use 8 byte bitmap custom character v0.5.4 * Update driver includes and LDFLAGS (fixed glk and bayrad binding error) diff --git a/server/drivers/i2500vfd.c b/server/drivers/i2500vfd.c index ece5c4d..c03c243 100644 --- a/server/drivers/i2500vfd.c +++ b/server/drivers/i2500vfd.c @@ -335,7 +335,8 @@ i2500vfd_chr (Driver *drvthis, int x, int y, char c) MODULE_EXPORT void i2500vfd_set_char (Driver *drvthis, int n, char *dat) { - int row, col; + int row; + unsigned char mask = (1 << CELLWIDTH) - 1; if (n < 0 || n > 255) return; @@ -343,12 +344,7 @@ i2500vfd_set_char (Driver *drvthis, int n, char *dat) return; for (row = 0; row < CELLHEIGHT; row++) { - int i = 0; - - for (col = 0; col < CELLWIDTH; col++) - i = (i << 1) | (dat[(row * CELLWIDTH) + col] > 0); - - i2500vfd_fontmap[n][row] = i; + i2500vfd_fontmap[n][row] = dat[row] & mask; } } @@ -427,37 +423,15 @@ i2500vfd_hbar(Driver *drvthis, int x, int y, int len, int promille, int pattern) MODULE_EXPORT int i2500vfd_icon (Driver *drvthis, int x, int y, int icon) { - static char heart_open[] = { - 1, 1, 1, 1, 1, - 1, 0, 1, 0, 1, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, - 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1 }; - - static char heart_filled[] = { - 1, 1, 1, 1, 1, - 1, 0, 1, 0, 1, - 0, 1, 0, 1, 0, - 0, 1, 1, 1, 0, - 0, 1, 1, 1, 0, - 1, 0, 1, 0, 1, - 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1 }; - switch (icon) { case ICON_BLOCK_FILLED: i2500vfd_chr(drvthis, x, y, 255); break; case ICON_HEART_FILLED: - i2500vfd_set_char(drvthis, 0, heart_filled); - i2500vfd_chr(drvthis, x, y, 0); + i2500vfd_chr(drvthis, x, y, 3); break; case ICON_HEART_OPEN: - i2500vfd_set_char(drvthis, 0, heart_open); - i2500vfd_chr(drvthis, x, y, 0); + i2500vfd_chr(drvthis, x, y, 4); break; default: return -1; diff --git a/server/drivers/i2500vfdfm.c b/server/drivers/i2500vfdfm.c index 39d4b8f..996413a 100644 --- a/server/drivers/i2500vfdfm.c +++ b/server/drivers/i2500vfdfm.c @@ -47,6 +47,22 @@ #define bOOOOOO 0x3f unsigned char i2500vfd_fontmap[256][8] = { + [0x03] {b_OOOOO, + b_O_O_O, + b__O_O_, + b__OOO_, + b__OOO_, + b_O_O_O, + b_OO_OO, + b_OOOOO}, + [0x04] {b_OOOOO, + b_O_O_O, + b______, + b______, + b______, + b_O___O, + b_OO_OO, + b_OOOOO}, [0x20] {b______, b______, b______, diff --git a/server/drivers/mdm166a.c b/server/drivers/mdm166a.c index 0ab0dd4..d72a3b8 100644 --- a/server/drivers/mdm166a.c +++ b/server/drivers/mdm166a.c @@ -88,7 +88,7 @@ MODULE_EXPORT char *symbol_prefix = "mdm166a_"; * \param x int_value * \return BCD_value */ -inline byte +inline byte toBCD(int x) { return (byte) (((x) / 10 * 16) + ((x) % 10)); @@ -99,7 +99,7 @@ toBCD(int x) * x,y. These are zero-based textmode positions. * The Fontmap is stored in rows while the framebuffer is stored * in columns, so we need a little conversion. - * + * * \param drvthis Pointer to driver structure. * \param x Horizontal character position (column). * \param y Vertical character position (row). @@ -253,7 +253,7 @@ mdm166a_close(Driver *drvthis) * on errors during init. p->hid may not be NULL even * if the device could not be open! */ - + /* Set clock */ if (p->showClock > 0) { tt = time(NULL); @@ -466,7 +466,8 @@ mdm166a_chr(Driver *drvthis, int x, int y, char c) MODULE_EXPORT void mdm166a_set_char(Driver *drvthis, int n, char *dat) { - int row, col; + int row; + unsigned char mask = (1 << CELLWIDTH) - 1; if (n < 0 || n > 255) return; @@ -474,12 +475,7 @@ mdm166a_set_char(Driver *drvthis, int n, char *dat) return; for (row = 0; row < CELLHEIGHT; row++) { - int i = 0; - - for (col = 0; col < CELLWIDTH; col++) - i = (i << 1) | (dat[(row * CELLWIDTH) + col] > 0); - - i2500vfd_fontmap[n][row] = i; + i2500vfd_fontmap[n][row] = dat[row] & mask; } } @@ -584,37 +580,15 @@ mdm166a_hbar(Driver *drvthis, int x, int y, int len, int promille, int pattern) MODULE_EXPORT int mdm166a_icon(Driver *drvthis, int x, int y, int icon) { - static char heart_open[] = { - 0, 1, 1, 1, 1, 1, - 0, 1, 0, 1, 0, 1, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 1, - 0, 1, 1, 0, 1, 1, - 0, 1, 1, 1, 1, 1}; - - static char heart_filled[] = { - 0, 1, 1, 1, 1, 1, - 0, 1, 0, 1, 0, 1, - 0, 0, 1, 0, 1, 0, - 0, 0, 1, 1, 1, 0, - 0, 0, 1, 1, 1, 0, - 0, 1, 0, 1, 0, 1, - 0, 1, 1, 0, 1, 1, - 0, 1, 1, 1, 1, 1}; - switch (icon) { case ICON_BLOCK_FILLED: mdm166a_chr(drvthis, x, y, 255); break; case ICON_HEART_FILLED: - mdm166a_set_char(drvthis, 0, heart_filled); - mdm166a_chr(drvthis, x, y, 0); + mdm166a_chr(drvthis, x, y, 3); break; case ICON_HEART_OPEN: - mdm166a_set_char(drvthis, 0, heart_open); - mdm166a_chr(drvthis, x, y, 0); + mdm166a_chr(drvthis, x, y, 4); break; default: return -1; @@ -669,7 +643,7 @@ mdm166a_backlight(Driver *drvthis, int on) * 8..12 Volume level bar (decimal 0..28) * 13..14 WLAN strength (decimal 0..3) * \endverbatim - * + * * \param drvthis Pointer to driver structure. * \param on Integer with bits representing LED states. */