convert bignum library; adapt serialVFD, CFontzPacket, IOWarrior

This commit is contained in:
marschap
2006-04-25 20:13:28 +00:00
parent 2d7bc08f12
commit 95a54cfbc1
11 changed files with 740 additions and 1037 deletions
+2
View File
@@ -9,6 +9,8 @@ v.0.5dev (ongoing development)
+ config file support in lcdproc client (thanks Andrew Foss)
* install server & client config files in $(sysconfdir)
+ new client lcdvc: virtual console on LCD
* convert adv_bignum library to bitwise set_char()
* adapt IOWarrior, CFontzPacket, seriaVFD to modified bignum library
v0.5.0
This version has split off from unstable-0.4.3. Includes major changes.
+1 -1
View File
@@ -117,7 +117,7 @@ API_VERSION in the code.
// - It is currently unclear how this system should work exactly
// - The set_char function expects a simple block of data with 1 byte for each pixel-line.
// (So that is 8 bytes for a 5x8 char)
void (*set_char) (Driver *drvthis, char ch, char *dat);
void (*set_char) (Driver *drvthis, char ch, unsigned char *dat);
int (*get_free_chars) (Driver *drvthis);
// get width & height of a character cell (in pixels)
+4 -2
View File
@@ -132,7 +132,7 @@ API_VERSION in the code.
// - It is currently unclear how this system should work exactly
// - The set_char function expects a simple block of data with 1 byte for each pixel-line.
// (So that is 8 bytes for a 5x8 char)
void (*set_char) (Driver *drvthis, char ch, char *dat);
void (*set_char) (Driver *drvthis, char ch, unsigned char *dat);
int (*get_free_chars) (Driver *drvthis);
// get width / height of a character cell (in pixels)
@@ -473,10 +473,12 @@ typedef struct my_driver_private {
<funcdef>void <function>(*set_char)</function></funcdef>
<paramdef>Driver *<parameter>drvthis</parameter></paramdef>
<paramdef>char <parameter>ch</parameter></paramdef>
<paramdef>char *<parameter>dat</parameter></paramdef>
<paramdef>unsigned char *<parameter>dat</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
The set_char function expects a simple block of data with 1 byte for each pixel-line.
(So that is 8 bytes for a 5x8 char)
</para>
<funcsynopsis>
+11 -202
View File
@@ -75,30 +75,7 @@
#include "report.h"
#include "lcd_lib.h"
#include "CFontz-charmap.h"
#define b_______ 0x00
#define b_____X_ 0x03
#define b_____XX 0x03
#define b____X__ 0x04
#define b____XX_ 0x06
#define b____XXX 0x07
#define b___X___ 0x08
#define b___XX__ 0x09
#define b___X_X_ 0x0A
#define b___XXX_ 0x0E
#define b___XXXX 0x0F
#define b__X____ 0x10
#define b__X___X 0x11
#define b__X_X_X 0x15
#define b__X_XX_ 0x16
#define b__XX___ 0x18
#define b__XX_XX 0x1B
#define b__XXX__ 0x1C
#define b__XXX_X 0x1D
#define b__XXXX_ 0x1E
#define b__XXXXX 0x1F
#define b_XXX___ 0x38
#define b_XXXXXX 0x3F
#include "adv_bignum.h"
#define CFP_KEY_UP 1
@@ -943,200 +920,32 @@ CFontzPacket_hbar (Driver *drvthis, int x, int y, int len, int promille, int opt
/*
* Inits big numbers
* Writes a big number.
*/
static void
CFontzPacket_init_num(Driver *drvthis)
MODULE_EXPORT void
CFontzPacket_num(Driver *drvthis, int x, int num)
{
PrivateData *p = drvthis->private_data;
int do_init = 0;
unsigned char bignum_ccs[8][CELLHEIGHT] = {
[0]
{ b_XXX___,
b_XXX___,
b_XXX___,
b_XXX___,
b_______,
b_______,
b_______,
b_______ },
[1]
{ b____XXX,
b____XXX,
b____XXX,
b____XXX,
b_XXX___,
b_XXX___,
b_XXX___,
b_XXX___ },
[2]
{ b_XXXXXX,
b_XXXXXX,
b_XXXXXX,
b_XXXXXX,
b_______,
b_______,
b_______,
b_______ },
[3]
{ b_______,
b_______,
b_______,
b_______,
b_XXX___,
b_XXX___,
b_XXX___,
b_XXX___ },
[4]
{ b_XXX___,
b_XXX___,
b_XXX___,
b_XXX___,
b____XXX,
b____XXX,
b____XXX,
b____XXX },
[5]
{ b_______,
b_______,
b_______,
b_______,
b_XXXXXX,
b_XXXXXX,
b_XXXXXX,
b_XXXXXX },
[6]
{ b_XXX___,
b_XXX___,
b_XXX___,
b_XXX___,
b_XXX___,
b_XXX___,
b_XXX___,
b_XXX___ },
[7]
{ b____XXX,
b____XXX,
b____XXX,
b____XXX,
b_______,
b_______,
b_______,
b_______ }
};
if ((num < 0) || (num > 10))
return;
if (p->ccmode != bignum) {
int i;
if (p->ccmode != standard) {
/* Not supported (yet) */
report(RPT_WARNING, "%s: init_num: cannot combine two modes using user defined characters",
report(RPT_WARNING, "%s: num: cannot combine two modes using user defined characters",
drvthis->name);
return;
}
p->ccmode = bignum;
for (i = 0; i < NUM_CCs; i++)
CFontzPacket_set_char(drvthis, i, bignum_ccs[i]);
do_init = 1;
}
}
/*
* Writes a big number.
* Only works on 4-line displays
*/
MODULE_EXPORT void
CFontzPacket_num(Driver *drvthis, int x, int num)
{
PrivateData *p = drvthis->private_data;
/* each bignum is constructed in a 3 x 4 matrix and consists
* of only the 8 characters defined above as well as ' '
*
* The following table defines the 11 big numbers '0'-'9', ':'
* and the custom base characters they consist of
*/
char bignum_map[11][4][3] = {
{ /* 0: */
{ 1, 2, 3 },
{ 6, 32, 6 },
{ 6, 32, 6 },
{ 7, 2, 32 } },
{ /* 1: */
{ 7, 6, 32 },
{ 32, 6, 32 },
{ 32, 6, 32 },
{ 7, 2, 32 } },
{ /* 2: */
{ 1, 2, 3 },
{ 32, 5, 0 },
{ 1, 32, 32 },
{ 2, 2, 0 } },
{ /* 3: */
{ 1, 2, 3 },
{ 32, 5, 0 },
{ 3, 32, 6 },
{ 7, 2, 32 } },
{ /* 4: */
{ 32, 3, 6 },
{ 1, 32, 6 },
{ 2, 2, 6 },
{ 32, 32, 0 } },
{ /* 5: */
{ 1, 2, 0 },
{ 2, 2, 3 },
{ 3, 32, 6 },
{ 7, 2, 32 } },
{ /* 6: */
{ 1, 2, 32 },
{ 6, 5, 32 },
{ 6, 32, 6 },
{ 7, 2, 32 } },
{ /* 7: */
{ 2, 2, 6 },
{ 32, 1, 32 },
{ 32, 6, 32 },
{ 32, 0, 32 } },
{ /* 8: */
{ 1, 2, 3 },
{ 4, 5, 0 },
{ 6, 32, 6 },
{ 7, 2, 32 } },
{ /* 9: */
{ 1, 2, 3 },
{ 4, 3, 6 },
{ 32, 1, 32 },
{ 7, 32, 32 } },
{ /* colon: (only 1st column used) */
{ 32, 32, 32 },
{ 0, 32, 32 },
{ 0, 32, 32 },
{ 32, 32, 32 } }
};
if ((num < 0) || (num > 10))
return;
if (p->height >= 4) {
int y = (p->height - 2) / 2; /* center vertically */
int x2, y2;
CFontzPacket_init_num(drvthis);
for (x2 = 0; x2 < 3; x2++) {
for (y2 = 0; y2 < 4; y2++) {
CFontzPacket_chr(drvthis, x+x2, y+y2, bignum_map[num][y2][x2]);
}
if (num == 10)
x2 = 2; /* = break, for colon only */
}
}
else {
CFontzPacket_chr(drvthis, x, 1 + (p->height - 1) / 2,
(num == 10) ? ':' : (num + '0'));
}
// Lib_adv_bignum does everything needed to show the bignumbers.
lib_adv_bignum(drvthis, x, num, do_init, NUM_CCs);
}
+16 -203
View File
@@ -44,27 +44,7 @@
#include "IOWarrior.h"
#include "report.h"
#include "lcd_lib.h"
#define b_______ 0x00
#define b_____X_ 0x03
#define b_____XX 0x03
#define b____X__ 0x04
#define b____XX_ 0x06
#define b___X___ 0x08
#define b___XX__ 0x09
#define b___X_X_ 0x0A
#define b___XXX_ 0x0E
#define b___XXXX 0x0F
#define b__X____ 0x10
#define b__X___X 0x11
#define b__X_X_X 0x15
#define b__X_XX_ 0x16
#define b__XX___ 0x18
#define b__XX_XX 0x1B
#define b__XXX__ 0x1C
#define b__XXX_X 0x1D
#define b__XXXX_ 0x1E
#define b__XXXXX 0x1F
#include "adv_bignum.h"
@@ -747,108 +727,6 @@ PrivateData *p = drvthis->private_data;
}
/*******************************************************************
* API: Sets up for big numbers
*/
static void
IOWarrior_init_num(Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
unsigned char bignum_ccs[8][CELLHEIGHT] = {
[0]
{ b__XX___,
b__XX___,
b__XX___,
b__XX___,
b_______,
b_______,
b_______,
b_______ },
[1]
{ b_____XX,
b_____XX,
b_____XX,
b_____XX,
b__XX___,
b__XX___,
b__XX___,
b__XX___ },
[2]
{ b__XX_XX,
b__XX_XX,
b__XX_XX,
b__XX_XX,
b_______,
b_______,
b_______,
b_______ },
[3]
{ b_______,
b_______,
b_______,
b_______,
b__XX___,
b__XX___,
b__XX___,
b__XX___ },
[4]
{ b__XX___,
b__XX___,
b__XX___,
b__XX___,
b_____XX,
b_____XX,
b_____XX,
b_____XX },
[5]
{ b_______,
b_______,
b_______,
b_______,
b__XX_XX,
b__XX_XX,
b__XX_XX,
b__XX_XX },
[6]
{ b__XX___,
b__XX___,
b__XX___,
b__XX___,
b__XX___,
b__XX___,
b__XX___,
b__XX___ },
[7]
{ b_____XX,
b_____XX,
b_____XX,
b_____XX,
b_______,
b_______,
b_______,
b_______ }
};
if (p->ccmode != bignum) {
int i;
if (p->ccmode != standard) {
/* Not supported (yet) */
report(RPT_WARNING, "%s: init_num: cannot combine two modes using user defined characters",
drvthis->name);
return;
}
p->ccmode = bignum;
for (i = 0; i < NUM_CCs; i++) {
IOWarrior_set_char(drvthis, i, bignum_ccs[i]);
}
}
}
/*******************************************************************
* API: Writes a big number.
*/
@@ -856,91 +734,26 @@ MODULE_EXPORT void
IOWarrior_num(Driver *drvthis, int x, int num)
{
PrivateData *p = drvthis->private_data;
int do_init = 0;
/* each bignum is constructed in a 3 x 4 matrix and consists
* of only the 8 characters defined above as well as ' '
*
* The following table defines the 11 big numbers '0'-'9', ':'
* and the custom base characters they consist of
*/
char bignum_map[11][4][3] = {
{ /* 0: */
{ 1, 2, 3 },
{ 6, 32, 6 },
{ 6, 32, 6 },
{ 7, 2, 32 } },
{ /* 1: */
{ 7, 6, 32 },
{ 32, 6, 32 },
{ 32, 6, 32 },
{ 7, 2, 32 } },
{ /* 2: */
{ 1, 2, 3 },
{ 32, 5, 0 },
{ 1, 32, 32 },
{ 2, 2, 0 } },
{ /* 3: */
{ 1, 2, 3 },
{ 32, 5, 0 },
{ 3, 32, 6 },
{ 7, 2, 32 } },
{ /* 4: */
{ 32, 3, 6 },
{ 1, 32, 6 },
{ 2, 2, 6 },
{ 32, 32, 0 } },
{ /* 5: */
{ 1, 2, 0 },
{ 2, 2, 3 },
{ 3, 32, 6 },
{ 7, 2, 32 } },
{ /* 6: */
{ 1, 2, 32 },
{ 6, 5, 32 },
{ 6, 32, 6 },
{ 7, 2, 32 } },
{ /* 7: */
{ 2, 2, 6 },
{ 32, 1, 32 },
{ 32, 6, 32 },
{ 32, 0, 32 } },
{ /* 8: */
{ 1, 2, 3 },
{ 4, 5, 0 },
{ 6, 32, 6 },
{ 7, 2, 32 } },
{ /* 9: */
{ 1, 2, 3 },
{ 4, 3, 6 },
{ 32, 1, 32 },
{ 7, 32, 32 } },
{ /* colon: (only 1st column used) */
{ 32, 32, 32 },
{ 0, 32, 32 },
{ 0, 32, 32 },
{ 32, 32, 32 } }
};
if ((num < 0) || (num > 10))
return;
if ((num < 0) || (num > 10))
return;
if (p->ccmode != bignum) {
if (p->ccmode != standard) {
/* Not supported (yet) */
report(RPT_WARNING, "%s: num: cannot combine two modes using user defined characters",
drvthis->name);
return;
}
IOWarrior_init_num(drvthis);
p->ccmode = bignum;
if (p->height >= 4) {
int y = (p->height - 2) / 2; /* center vertically */
int x2, y2;
do_init = 1;
}
for (x2 = 0; x2 < 3; x2++) {
for (y2 = 0; y2 < 4; y2++) {
IOWarrior_chr(drvthis, x+x2, y+y2, bignum_map[num][y2][x2]);
}
if (num == 10)
x2 = 2; /* = break, for colon only */
}
}
else
IOWarrior_chr(drvthis, x, 1 + (p->height - 1)/ 2,
(num == 10) ? ':' : (num + '0'));
// Lib_adv_bignum does everything needed to show the bignumbers.
lib_adv_bignum(drvthis, x, num, do_init, NUM_CCs);
}
+5 -5
View File
@@ -27,7 +27,7 @@ hd44780_CFLAGS = @libusb_cflags@ $(AM_CFLAGS)
CFontz_LDADD = libLCD.a
CFontz633_LDADD = libLCD.a
CFontzPacket_LDADD = libLCD.a
CFontzPacket_LDADD = libLCD.a libbignum.a
curses_LDADD = @LIBCURSES@
CwLnx_LDADD = libLCD.a
glcdlib_LDADD = libLCD.a @LIBGLCD@
@@ -35,7 +35,7 @@ hd44780_LDADD = libLCD.a @HD44780_DRIVERS@ @libusb_libs@
hd44780_DEPENDENCIES = @HD44780_DRIVERS@
icp_a106_LDADD = libLCD.a
imon_LDADD = libLCD.a
IOWarrior_LDADD = @libusb_libs@ libLCD.a
IOWarrior_LDADD = @libusb_libs@ libLCD.a libbignum.a
irman_LDADD = @LIBIRMAN@
lirc_LDADD = @LIBLIRC_CLIENT@
lcterm_LDADD = libLCD.a
@@ -47,7 +47,7 @@ svga_LDADD = @LIBSVGA@
t6963_LDADD = libLCD.a
tyan_LDADD = libLCD.a
ula200_LDADD = libLCD.a @LIBFTDI@
sli_LDADD = libLCD.a
sli_LDADD = libLCD.a
xosd_LDADD = @LIBXOSD@
libLCD_a_SOURCES = lcd_lib.h lcd_lib.c
@@ -56,7 +56,7 @@ libbignum_a_SOURCES = adv_bignum.h adv_bignum.c
bayrad_SOURCES = lcd.h lcd_lib.h bayrad.h bayrad.c report.h
CFontz_SOURCES = lcd.h lcd_lib.h CFontz.c CFontz.h CFontz-charmap.h report.h
CFontz633_SOURCES = lcd.h lcd_lib.h CFontz633.c CFontz633.h CFontz-charmap.h CFontz633io.c CFontz633io.h report.h
CFontzPacket_SOURCES = lcd.h lcd_lib.h CFontzPacket.c CFontzPacket.h CFontz-charmap.h CFontz633io.c CFontz633io.h report.h
CFontzPacket_SOURCES = lcd.h lcd_lib.h CFontzPacket.c CFontzPacket.h CFontz-charmap.h CFontz633io.c CFontz633io.h report.h adv_bignum.h
curses_SOURCES = lcd.h curses_drv.h curses_drv.c report.h
CwLnx_SOURCES = lcd.h lcd_lib.h CwLnx.c CwLnx.h report.h
glcdlib_SOURCES = lcd.h lcd_lib.h glcdlib.h glcdlib.c report.h
@@ -66,7 +66,7 @@ EXTRA_hd44780_SOURCES = hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-
icp_a106_SOURCES = lcd.h lcd_lib.h icp_a106.c icp_a106.h report.h
imon_SOURCES = lcd.h lcd_lib.h imon.h imon.c report.h
IOWarrior_SOURCES = lcd.h lcd_lib.h hd44780-charmap.h IOWarrior.c IOWarrior.h report.h
IOWarrior_SOURCES = lcd.h lcd_lib.h hd44780-charmap.h IOWarrior.c IOWarrior.h report.h adv_bignum.h
irman_SOURCES = lcd.h irmanin.c irmanin.h report.h
joy_SOURCES = lcd.h joy.c joy.h port.h report.h
lb216_SOURCES = lcd.h lb216.c lb216.h report.h
File diff suppressed because it is too large Load Diff
+28 -1
View File
@@ -27,7 +27,34 @@
#include "lcd.h"
void lib_adv_bignum (Driver *drvthis, int x, int num, int height , int do_init, int customchars);
#define b_______ 0x00
#define b______X 0x01
#define b_____X_ 0x03
#define b_____XX 0x03
#define b____X__ 0x04
#define b____XX_ 0x06
#define b____XXX 0x07
#define b___X___ 0x08
#define b___XX__ 0x09
#define b___X_X_ 0x0A
#define b___XXX_ 0x0E
#define b___XXXX 0x0F
#define b__X____ 0x10
#define b__X___X 0x11
#define b__X_X_X 0x15
#define b__X_XX_ 0x16
#define b__XX___ 0x18
#define b__XX__X 0x19
#define b__XX_XX 0x1B
#define b__XXX__ 0x1C
#define b__XXX_X 0x1D
#define b__XXXX_ 0x1E
#define b__XXXXX 0x1F
#define b_XXX___ 0x38
#define b_XXXXXX 0x3F
void lib_adv_bignum (Driver *drvthis, int x, int num, int do_init, int customchars);
+1 -1
View File
@@ -150,7 +150,7 @@ typedef struct lcd_logical_driver {
void (*cursor) (struct lcd_logical_driver* drvthis, int x, int y, int type);
/* user-defined character functions, are those still supported ? */
void (*set_char) (struct lcd_logical_driver* drvthis, int n, char *dat);
void (*set_char) (struct lcd_logical_driver* drvthis, int n, unsigned char *dat);
int (*get_free_chars) (struct lcd_logical_driver* drvthis);
int (*cellwidth) (struct lcd_logical_driver* drvthis);
int (*cellheight) (struct lcd_logical_driver* drvthis);
+63 -135
View File
@@ -426,13 +426,14 @@ serialVFD_init (Driver *drvthis)
p->charmap[tmp] = charmap_0[tmp];
//{bytes to send, icon bit mapped to bit 0, icon bit mapped to bit 1, ...}
const int usr_chr_dot_assignment_0[57]={7, 1, 2, 3, 4, 5, 0, 0, 0,
6, 7, 8, 9,10, 0, 0, 0,
const int usr_chr_dot_assignment_0[57]={ 7,
1, 2, 3, 4, 5, 0, 0, 0,
6, 7, 8, 9,10, 0, 0, 0,
11,12,13,14,15, 0, 0, 0,
16,17,18,19,20, 0, 0, 0,
21,22,23,24,25, 0, 0, 0,
26,27,28,29,30, 0, 0, 0,
31,32,33,34,35, 0, 0, 0};
31,32,33,34,35, 0, 0, 0 };
for (tmp = 0; tmp < 57 ;tmp++)
p->usr_chr_dot_assignment[tmp] = usr_chr_dot_assignment_0[tmp];
@@ -497,8 +498,9 @@ serialVFD_init (Driver *drvthis)
//{bytes to send, icon bit mapped to bit 0, icon bit mapped to bit 1, ...}
const int usr_chr_dot_assignment_1[57]={7, 1, 2, 3, 4, 5, 0, 0, 0,
6, 7, 8, 9,10, 0, 0, 0,
const int usr_chr_dot_assignment_1[57]={ 7,
1, 2, 3, 4, 5, 0, 0, 0,
6, 7, 8, 9,10, 0, 0, 0,
11,12,13,14,15, 0, 0, 0,
16,17,18,19,20, 0, 0, 0,
21,22,23,24,25, 0, 0, 0,
@@ -546,12 +548,13 @@ serialVFD_init (Driver *drvthis)
p->charmap[tmp]=tmp;
//{bytes to send, icon bit mapped to bit 0, icon bit mapped to bit 1, ...}
const int usr_chr_dot_assignment_2[57]={5, 1, 2, 3, 4, 5, 6, 7, 8,
const int usr_chr_dot_assignment_2[57]={ 5,
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,
33,34,35, 0, 0, 0, 0, 0};
for (tmp=0;tmp < 57 ;tmp++)
for (tmp=0; tmp < 57; tmp++)
p->usr_chr_dot_assignment[tmp]=usr_chr_dot_assignment_2[tmp];
//Where to place the usercharacters (0..30) in the asciicode.
@@ -615,11 +618,12 @@ serialVFD_init (Driver *drvthis)
p->charmap[tmp] = charmap_3[tmp];
//{bytes to send, icon bit mapped to bit 0, icon bit mapped to bit 1, ...}
const int usr_chr_dot_assignment_3[57]={5, 8, 7, 6, 5, 4, 3, 2, 1,
const int usr_chr_dot_assignment_3[57]={ 5,
8, 7, 6, 5, 4, 3, 2, 1,
16,15,14,13,12,11,10, 9,
24,23,22,21,20,19,18,17,
32,31,30,29,28,27,26,25,
0, 0, 0, 0, 0,35,34,33};
0, 0, 0, 0, 0,35,34,33};
for (tmp=0;tmp < 57 ;tmp++)
p->usr_chr_dot_assignment[tmp]=usr_chr_dot_assignment_3[tmp];
@@ -710,7 +714,7 @@ serialVFD_hbar (Driver *drvthis, int x, int y, int len, int promille, int option
// The input is just an array of characters...
//
MODULE_EXPORT void
serialVFD_set_char (Driver *drvthis, int n, char *dat)
serialVFD_set_char (Driver *drvthis, int n, unsigned char *dat)
{ //set char in p->custom_char
PrivateData *p = drvthis->private_data;
unsigned int byte, bit;
@@ -724,8 +728,14 @@ serialVFD_set_char (Driver *drvthis, int n, char *dat)
int letter = 0;
for (bit = 0; bit < 8; bit++) {
if ((int) p->usr_chr_dot_assignment[bit+8*byte+1] != 0)
letter |= (dat[(int)p->usr_chr_dot_assignment[bit+8*byte+1]-1] << bit);
int pos = (int) p->usr_chr_dot_assignment[bit+8*byte+1];
if (pos > 0) {
int posbyte = (pos-1) / 5;
int posbit = 4 - ((pos-1) % 5);
letter |= ((dat[posbyte] >> posbit) & 1) << bit;;
}
}
p->custom_char[n][byte] = letter;
}
@@ -848,7 +858,7 @@ serialVFD_num( Driver * drvthis, int x, int num )
p->ccmode = CCMODE_BIGNUM; // Switch customcharactermode to bignum.
}
// Lib_adv_bignum does everything needed to show the bignumbers.
lib_adv_bignum(drvthis, x, num, p->height, do_init, p->customchars);
lib_adv_bignum(drvthis, x, num, do_init, p->customchars);
}
@@ -860,27 +870,25 @@ MODULE_EXPORT int
serialVFD_icon (Driver *drvthis, int x, int y, int icon)
{
PrivateData *p = drvthis->private_data;
char icons[2][5 * 7] = {
{
1, 1, 1, 1, 1, // Empty Heart
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,
},
static unsigned char heart_open[] =
{ b__XXXXX,
b__X_X_X,
b_______,
b_______,
b_______,
b__X___X,
b__XX_XX,
b__XXXXX };
static unsigned char heart_filled[] =
{ b__XXXXX,
b__X_X_X,
b___X_X_,
b___XXX_,
b___XXX_,
b__X_X_X,
b__XX_XX,
b__XXXXX };
{
1, 1, 1, 1, 1, // Filled Heart
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,
},
};
// Yes we know, this is a VERY BAD implementation :-)
switch (icon) {
case ICON_BLOCK_FILLED:
@@ -888,12 +896,12 @@ serialVFD_icon (Driver *drvthis, int x, int y, int icon)
break;
case ICON_HEART_FILLED:
p->ccmode = CCMODE_STANDARD;
serialVFD_set_char(drvthis, 0, icons[1]);
serialVFD_set_char(drvthis, 0, heart_filled);
serialVFD_chr(drvthis, x, y, 0);
break;
case ICON_HEART_OPEN:
p->ccmode = CCMODE_STANDARD;
serialVFD_set_char(drvthis, 0, icons[0]);
serialVFD_set_char(drvthis, 0, heart_open);
serialVFD_chr(drvthis, x, y, 0);
break;
default:
@@ -911,69 +919,20 @@ static void
serialVFD_init_vbar (Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
char a[] = {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
};
char b[] = {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
};
char c[] = {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
};
char d[] = {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
};
char e[] = {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
};
char f[] = {
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
};
if (p->ccmode != CCMODE_VBAR) {
unsigned char vBar[p->cellheight];
int i;
p->ccmode = CCMODE_VBAR;
serialVFD_set_char(drvthis, 1, a);
serialVFD_set_char(drvthis, 2, b);
serialVFD_set_char(drvthis, 3, c);
serialVFD_set_char(drvthis, 4, d);
serialVFD_set_char(drvthis, 5, e);
serialVFD_set_char(drvthis, 6, f);
memset(vBar, 0x00, sizeof(vBar));
for (i = 1; i < p->cellheight; i++) {
// add pixel line per pixel line ...
vBar[p->cellheight - i] = 0xFF;
serialVFD_set_char(drvthis, i, vBar);
}
}
}
@@ -984,49 +943,18 @@ static void
serialVFD_init_hbar (Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
char a[] = {
1, 0, 0, 0, 0,
1, 0, 0, 0, 0,
1, 0, 0, 0, 0,
1, 0, 0, 0, 0,
1, 0, 0, 0, 0,
1, 0, 0, 0, 0,
1, 0, 0, 0, 0,
};
char b[] = {
1, 1, 0, 0, 0,
1, 1, 0, 0, 0,
1, 1, 0, 0, 0,
1, 1, 0, 0, 0,
1, 1, 0, 0, 0,
1, 1, 0, 0, 0,
1, 1, 0, 0, 0,
};
char c[] = {
1, 1, 1, 0, 0,
1, 1, 1, 0, 0,
1, 1, 1, 0, 0,
1, 1, 1, 0, 0,
1, 1, 1, 0, 0,
1, 1, 1, 0, 0,
1, 1, 1, 0, 0,
};
char d[] = {
1, 1, 1, 1, 0,
1, 1, 1, 1, 0,
1, 1, 1, 1, 0,
1, 1, 1, 1, 0,
1, 1, 1, 1, 0,
1, 1, 1, 1, 0,
1, 1, 1, 1, 0,
};
if (p->ccmode != CCMODE_HBAR) {
unsigned char hBar[p->cellheight];
int i;
p->ccmode = CCMODE_HBAR;
serialVFD_set_char(drvthis, 1, a);
serialVFD_set_char(drvthis, 2, b);
serialVFD_set_char(drvthis, 3, c);
serialVFD_set_char(drvthis, 4, d);
for (i = 1; i < p->cellwidth; i++) {
// fill pixel columns from left to right.
memset(hBar, 0xFF & ~((1 << (p->cellwidth - i)) - 1), sizeof(hBar));
serialVFD_set_char(drvthis, i, hBar);
}
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ MODULE_EXPORT void serialVFD_vbar (Driver *drvthis, int x, int y, int len, int p
MODULE_EXPORT void serialVFD_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
MODULE_EXPORT int serialVFD_icon(Driver *drvthis, int x, int y, int icon);
MODULE_EXPORT void serialVFD_set_char (Driver *drvthis, int n, char *dat);
MODULE_EXPORT void serialVFD_set_char (Driver *drvthis, int n, unsigned char *dat);
MODULE_EXPORT int serialVFD_get_brightness (Driver *drvthis, int state);
MODULE_EXPORT void serialVFD_set_brightness (Driver *drvthis, int state, int promille);