Convert set_char of drivers bayrad, lb216, lcterm, mtc_s16209x, wirz-sli.
lb216: Convert lb216_hbar and vbar to 0.5 API. lcterm: Replace bignum implementation with the one from bignum library.
This commit is contained in:
@@ -22,6 +22,7 @@ v.0.5dev (ongoing development)
|
||||
* sed1520: Make it work with 68-family style interface, convert to 0.5 API
|
||||
* hd44780/imon: Add charmap for NEC uPD16314 and make it configurable
|
||||
* Pyramid: Convert set_char to 8 byte bitmap, add support for bignum
|
||||
* Convert set_char of drivers bayrad, lb216, lcterm, mtc_s16209x, wirz-sli
|
||||
|
||||
v0.5.4
|
||||
* Update driver includes and LDFLAGS (fixed glk and bayrad binding error)
|
||||
|
||||
@@ -5,41 +5,34 @@ yourself by running the doxygen command from the docs/ directory.
|
||||
Ideas for new features can be entered at the IdeaTorrent:
|
||||
http://sourceforge.net/apps/ideatorrent/lcdproc/
|
||||
|
||||
----------------------------------------
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Stuff planned for future releases... (in no particular order)
|
||||
Feel free to help out with any of this stuff! :)
|
||||
Please send a message to the mailing list if you have any question.
|
||||
|
||||
Things for the short term:
|
||||
- Use centralized command message parsing engine (more secure)
|
||||
- more features for existing display drivers (e.g. adapt them to bignum library)
|
||||
- lcd_lib: Make use of the options parameter to specify SEAMLESS_HBARS, the
|
||||
height of hbars, etc.
|
||||
- lcterm: Support keyboard input
|
||||
- MtxOrb: Recover the code for I2C connectivity to MtxOrb
|
||||
- shuttleVFD: Use output() method for these special "out-of-band" symbols.
|
||||
Things for the short term
|
||||
=========================
|
||||
- Use non-standard serial baud rates (57600 and higher) only optional.
|
||||
|
||||
|
||||
Things for the longer term:
|
||||
----------------------------------------
|
||||
Things for the longer term
|
||||
==========================
|
||||
|
||||
lcdproc client
|
||||
--------------
|
||||
|
||||
allow more than one instance of a screen with different configuration
|
||||
sections (implementation should be possible similar to the one with
|
||||
the drivers in LCDd where File=... points to the original driver file)
|
||||
- allow more than one instance of a screen with different configuration
|
||||
sections (implementation should be possible similar to the one with
|
||||
the drivers in LCDd where File=... points to the original driver file)
|
||||
- more options in the config file (clocks with offsets from localtime, ...)
|
||||
- more options changeable in the lcdproc client menu
|
||||
- rewrite machine_get_fs() in machine_Linux.c to use functions from mntent.h
|
||||
- get rid of MTAB_FILE compile time definition (for Linux & SunOS)
|
||||
|
||||
more options in the config file (clocks with offsets from localtime, ...)
|
||||
|
||||
more options changeable in the lcdproc client menu
|
||||
|
||||
rewrite machine_get_fs() in machine_Linux.c to use functions from mntent.h
|
||||
|
||||
get rid of MTAB_FILE compile time definition (for Linux & SunOS)
|
||||
|
||||
----------------------------------------
|
||||
lcdexec client
|
||||
--------------
|
||||
|
||||
more flexbibility: do not just only execute commands, but
|
||||
maybe also display their result in a screen, get a command's
|
||||
@@ -47,8 +40,9 @@ parameters interactively using the builtin input menus,
|
||||
confirmation of commands, jumping between commands depending
|
||||
on the output of a command (wizards), ...
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Client driver
|
||||
-------------
|
||||
|
||||
An LCDproc client can connect, request the "client" driver, then get
|
||||
all screen information sent to it! This allows things such as logging
|
||||
@@ -64,5 +58,3 @@ command line. Or,
|
||||
lcdtool -key A
|
||||
|
||||
would have the same result as pressing a key on the keypad.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
@@ -51,7 +51,8 @@ imon_LDADD = libLCD.a
|
||||
imonlcd_LDADD = libLCD.a
|
||||
IOWarrior_LDADD = @LIBUSB_LIBS@ libLCD.a libbignum.a
|
||||
irman_LDADD = @LIBIRMAN@
|
||||
lcterm_LDADD = libLCD.a
|
||||
lb216_LDADD = libLCD.a
|
||||
lcterm_LDADD = libLCD.a libbignum.a
|
||||
lirc_LDADD = @LIBLIRC_CLIENT@
|
||||
lis_LDADD = libLCD.a @LIBFTDI_LIBS@ @LIBUSB_LIBS@ @LIBPTHREAD_LIBS@ libbignum.a
|
||||
mdm166a_LDADD = @LIBHID_LIBS@ libLCD.a
|
||||
@@ -97,7 +98,7 @@ IOWarrior_SOURCES = lcd.h lcd_lib.h hd44780-charmap.h IOWarrior.c IOWarrior.h r
|
||||
irman_SOURCES = lcd.h irmanin.c irmanin.h report.h
|
||||
irtrans_SOURCES = lcd.h irtrans.c irtrans.h irtrans_network.h irtrans_remote.h irtrans_errcode.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
|
||||
lb216_SOURCES = lcd.h lcd_lib.h lb216.c lb216.h report.h
|
||||
lcdm001_SOURCES = lcd.h lcdm001.c lcdm001.h report.h
|
||||
lcterm_SOURCES = lcd.h lcd_lib.h lcterm.c lcterm.h report.h
|
||||
lirc_SOURCES = lcd.h lircin.c lircin.h report.h
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* http://www.matrixorbital.ca/manuals/
|
||||
*
|
||||
* \note The GLK series of graphical displays is supported by the \c glk driver.
|
||||
*
|
||||
* \todo Recover the code for I2C connectivity to MtxOrb.
|
||||
*/
|
||||
|
||||
/*-
|
||||
|
||||
+49
-250
@@ -310,7 +310,6 @@ bayrad_string(Driver *drvthis, int x, int y, const char string[])
|
||||
break;
|
||||
|
||||
if ((c > 0x7F) && (c < 0x98)) {
|
||||
//c &= 0x7F;
|
||||
report(RPT_WARNING, "%s: illegal char 0x%02X requested in bayrad_string()",
|
||||
drvthis->name, c);
|
||||
c = ' ';
|
||||
@@ -375,222 +374,20 @@ bayrad_backlight(Driver *drvthis, int on)
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Tells the driver to get ready for vertical bargraphs.
|
||||
//
|
||||
static void
|
||||
bayrad_init_vbar(Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
static char bar_up[7][5*8] = {
|
||||
{
|
||||
0,0,0,0,0, // char u1[] =
|
||||
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,
|
||||
}, {
|
||||
0,0,0,0,0, // char u2[] =
|
||||
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,
|
||||
},{
|
||||
0,0,0,0,0, // char u3[] =
|
||||
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,
|
||||
},{
|
||||
0,0,0,0,0, // char u4[] =
|
||||
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,
|
||||
},{
|
||||
0,0,0,0,0, // char u5[] =
|
||||
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,
|
||||
},{
|
||||
0,0,0,0,0, // char u6[] =
|
||||
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,
|
||||
},{
|
||||
0,0,0,0,0, // char u7[] =
|
||||
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,
|
||||
1,1,1,1,1,
|
||||
}
|
||||
};
|
||||
|
||||
//debug(RPT_DEBUG,"Init Vertical bars");
|
||||
|
||||
if (p->ccmode == vbar) {
|
||||
/* Work already done */
|
||||
return;
|
||||
}
|
||||
|
||||
if (p->ccmode != standard) {
|
||||
/* Not supported (yet) */
|
||||
report(RPT_WARNING, "%s: cannot combine two modes using user-defined characters",
|
||||
drvthis->name);
|
||||
return;
|
||||
}
|
||||
p->ccmode = vbar;
|
||||
|
||||
bayrad_set_char(drvthis, 1, bar_up[0]);
|
||||
bayrad_set_char(drvthis, 2, bar_up[1]);
|
||||
bayrad_set_char(drvthis, 3, bar_up[2]);
|
||||
bayrad_set_char(drvthis, 4, bar_up[3]);
|
||||
bayrad_set_char(drvthis, 5, bar_up[4]);
|
||||
bayrad_set_char(drvthis, 6, bar_up[5]);
|
||||
bayrad_set_char(drvthis, 7, bar_up[6]);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Tells the driver to get ready for horizontal bargraphs.
|
||||
//
|
||||
static void
|
||||
bayrad_init_hbar(Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
static char bar_right[5][5*8] = {
|
||||
{
|
||||
1,0,0,0,0, // char r1[] =
|
||||
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,
|
||||
},{
|
||||
1,1,0,0,0, // char r2[] =
|
||||
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,
|
||||
},{
|
||||
1,1,1,0,0, // char r3[] =
|
||||
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,
|
||||
},{
|
||||
1,1,1,1,0, // char r4[] =
|
||||
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,
|
||||
},{
|
||||
1,1,1,1,1, // char r5[] =
|
||||
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,
|
||||
1,1,1,1,1,
|
||||
}
|
||||
};
|
||||
|
||||
//debug(RPT_DEBUG,"Init Horizontal bars");
|
||||
|
||||
if (p->ccmode == hbar) {
|
||||
/* Work already done */
|
||||
return;
|
||||
}
|
||||
|
||||
if (p->ccmode != standard) {
|
||||
/* Not supported (yet) */
|
||||
report(RPT_WARNING, "%s: cannot combine two modes using user-defined characters",
|
||||
drvthis->name);
|
||||
return;
|
||||
}
|
||||
p->ccmode = hbar;
|
||||
|
||||
bayrad_set_char(drvthis, 1, bar_right[0]);
|
||||
bayrad_set_char(drvthis, 2, bar_right[1]);
|
||||
bayrad_set_char(drvthis, 3, bar_right[2]);
|
||||
bayrad_set_char(drvthis, 4, bar_right[3]);
|
||||
bayrad_set_char(drvthis, 5, bar_right[4]);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Tells the driver to get ready for big numbers, if possible.
|
||||
//
|
||||
static void
|
||||
bayrad_init_num(Driver *drvthis)
|
||||
{
|
||||
//PrivateData *p = drvthis->private_data;
|
||||
|
||||
// debug(RPT_DEBUG,"Big Numbers");
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Draws a big (4-row) number.
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
bayrad_num(Driver *drvthis, int x, int num)
|
||||
{
|
||||
//PrivateData *p = drvthis->private_data;
|
||||
|
||||
// debug(RPT_DEBUG,"BigNum(%i, %i)", x, num);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define a custom character and write it to the LCD.
|
||||
* \param drvthis Pointer to driver structure.
|
||||
* \param n Custom character to define [0 - (NUM_CCs-1)].
|
||||
* \param dat Array of 40(=8*5=cellheight*cellwidth) bytes, each representing a pixel
|
||||
* starting from the top left to the bottom right.
|
||||
* \todo
|
||||
* Convert \c dat to use one byte per pixel row as e.g. in the \c CFontzPackage driver.
|
||||
* \param dat Array of 8 (= cellheight) bytes, each representing a row in
|
||||
* CGRAM starting from the top.
|
||||
*/
|
||||
MODULE_EXPORT void
|
||||
bayrad_set_char(Driver *drvthis, int n, char *dat)
|
||||
bayrad_set_char(Driver *drvthis, int n, unsigned char *dat)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
char out[4] = { 0x88, 0x0, 0x0, 0x0 };
|
||||
int row, col;
|
||||
int row;
|
||||
unsigned char mask = (1 << p->cellwidth) - 1;
|
||||
|
||||
//debug(RPT_DEBUG, "Set char %i", n);
|
||||
|
||||
@@ -605,12 +402,7 @@ bayrad_set_char(Driver *drvthis, int n, char *dat)
|
||||
write(p->fd, out, 2);
|
||||
|
||||
for (row = 0; row < p->cellheight; row++) {
|
||||
char letter = 0;
|
||||
|
||||
for (col = 0; col < p->cellwidth; col++) {
|
||||
letter <<= 1;
|
||||
letter |= (dat[(row * p->cellwidth) + col] > 0);
|
||||
}
|
||||
char letter = dat[row] & mask;
|
||||
write(p->fd, &letter, 1);
|
||||
}
|
||||
|
||||
@@ -632,10 +424,32 @@ MODULE_EXPORT void
|
||||
bayrad_vbar(Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
static unsigned char bar_up[7][8] = {
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
};
|
||||
|
||||
//debug(RPT_DEBUG, "Vbar at %i, length %i", x, len);
|
||||
|
||||
bayrad_init_vbar(drvthis);
|
||||
if (p->ccmode != vbar) {
|
||||
int i;
|
||||
|
||||
if (p->ccmode != standard) {
|
||||
/* Not supported (yet) */
|
||||
report(RPT_WARNING, "%s: cannot combine two modes using user-defined characters",
|
||||
drvthis->name);
|
||||
return;
|
||||
}
|
||||
p->ccmode = vbar;
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
bayrad_set_char(drvthis, i + 1, bar_up[i]);
|
||||
}
|
||||
|
||||
lib_vbar_static(drvthis, x, y, len, promille, options, p->cellheight, 0x98);
|
||||
}
|
||||
@@ -654,10 +468,28 @@ MODULE_EXPORT void
|
||||
bayrad_hbar(Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
static unsigned char bar_right[4][8] = {
|
||||
{0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10},
|
||||
{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
|
||||
{0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C},
|
||||
{0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E},
|
||||
};
|
||||
|
||||
//debug(RPT_DEBUG, "Hbar at %i,%i; length %i", x, y, len);
|
||||
|
||||
bayrad_init_hbar(drvthis);
|
||||
if (p->ccmode != hbar) {
|
||||
int i;
|
||||
|
||||
if (p->ccmode != standard) {
|
||||
report(RPT_WARNING, "%s: cannot combine two modes using user-defined characters",
|
||||
drvthis->name);
|
||||
return;
|
||||
}
|
||||
p->ccmode = hbar;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
bayrad_set_char(drvthis, i + 1, bar_right[i]);
|
||||
}
|
||||
|
||||
lib_hbar_static(drvthis, x, y, len, promille, options, p->cellwidth, 0x98);
|
||||
}
|
||||
@@ -675,38 +507,6 @@ bayrad_hbar(Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
MODULE_EXPORT int
|
||||
bayrad_icon(Driver *drvthis, int x, int y, int icon)
|
||||
{
|
||||
/*PrivateData *p = drvthis->private_data;
|
||||
static char icons[3][5*8] = {
|
||||
{
|
||||
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,
|
||||
1,1,1,1,1,
|
||||
},{
|
||||
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,
|
||||
1,1,1,1,1,
|
||||
},{
|
||||
0,0,0,0,0, // Ellipsis
|
||||
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,0,1,0,1,
|
||||
}
|
||||
};*/
|
||||
|
||||
switch (icon) {
|
||||
case ICON_BLOCK_FILLED:
|
||||
bayrad_chr( drvthis, x, y, 0xFF );
|
||||
@@ -764,11 +564,10 @@ bayrad_get_key(Driver *drvthis)
|
||||
else { /* read() error */
|
||||
report(RPT_ERR, "%s: Read error in BayRAD getchar", drvthis->name);
|
||||
}
|
||||
} /* if select */
|
||||
}
|
||||
else {
|
||||
;//debug(RPT_DEBUG, "No BayRAD data present");
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ MODULE_EXPORT void bayrad_vbar(Driver *drvthis, int x, int y, int len, int promi
|
||||
MODULE_EXPORT void bayrad_hbar(Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||
MODULE_EXPORT int bayrad_icon(Driver *drvthis, int x, int y, int icon);
|
||||
|
||||
MODULE_EXPORT void bayrad_set_char(Driver *drvthis, int n, char *dat);
|
||||
MODULE_EXPORT void bayrad_set_char(Driver *drvthis, int n, unsigned char *dat);
|
||||
|
||||
MODULE_EXPORT void bayrad_backlight(Driver *drvthis, int promille);
|
||||
|
||||
|
||||
+45
-210
@@ -1,7 +1,5 @@
|
||||
/** \file server/drivers/lb216.c
|
||||
* LCDd \c lb216 driver for the LB216 by R.T.N. Australia.
|
||||
*
|
||||
* \todo Convert to new style hbar and vbar!
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -33,6 +31,7 @@
|
||||
|
||||
#include "lcd.h"
|
||||
#include "lb216.h"
|
||||
#include "lcd_lib.h"
|
||||
#include "report.h"
|
||||
|
||||
#define LB216_DEFAULT_DEVICE "/dev/lcd"
|
||||
@@ -370,205 +369,57 @@ LB216_string (Driver *drvthis, int x, int y, const char string[])
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Sets up for vertical bars. Call before LB216->vbar()
|
||||
//
|
||||
static void
|
||||
LB216_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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
};
|
||||
char g[] = {
|
||||
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,
|
||||
1,1,1,1,1,
|
||||
};
|
||||
|
||||
if (p->custom != vbar) {
|
||||
LB216_set_char(drvthis, 1, a);
|
||||
LB216_set_char(drvthis, 2, b);
|
||||
LB216_set_char(drvthis, 3, c);
|
||||
LB216_set_char(drvthis, 4, d);
|
||||
LB216_set_char(drvthis, 5, e);
|
||||
LB216_set_char(drvthis, 6, f);
|
||||
LB216_set_char(drvthis, 7, g);
|
||||
p->custom = vbar;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Inits horizontal bars...
|
||||
//
|
||||
static void
|
||||
LB216_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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
1,1,1,1,0,
|
||||
};
|
||||
char e[] = {
|
||||
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,
|
||||
1,1,1,1,1,
|
||||
1,1,1,1,1,
|
||||
};
|
||||
|
||||
if (p->custom != hbar) {
|
||||
LB216_set_char(drvthis, 1, a);
|
||||
LB216_set_char(drvthis, 2, b);
|
||||
LB216_set_char(drvthis, 3, c);
|
||||
LB216_set_char(drvthis, 4, d);
|
||||
LB216_set_char(drvthis, 5, e);
|
||||
p->custom = hbar;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Draws a vertical bar...
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
LB216_vbar(Driver *drvthis, int x, int len)
|
||||
LB216_vbar(Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
char map[9] = { 32, 1, 2, 3, 4, 5, 6, 7, 255 };
|
||||
int y;
|
||||
static unsigned char vbar_char[7][8] = {
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}
|
||||
};
|
||||
|
||||
LB216_init_vbar(drvthis);
|
||||
if (p->custom != vbar) {
|
||||
int i;
|
||||
|
||||
for (y = p->height; (y > 0) && (len > 0); y--) {
|
||||
if (len >= p->cellheight)
|
||||
LB216_chr(drvthis, x, y, map[8]);
|
||||
else
|
||||
LB216_chr(drvthis, x, y, map[len]);
|
||||
|
||||
len -= p->cellheight;
|
||||
for (i = 0; i < 7; i++)
|
||||
LB216_set_char(drvthis, i + 1, vbar_char[i]);
|
||||
p->custom = vbar;
|
||||
}
|
||||
|
||||
lib_vbar_static(drvthis, x, y, len, promille, options, p->cellheight, 0);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Draws a horizontal bar to the right.
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
LB216_hbar(Driver *drvthis, int x, int y, int len)
|
||||
LB216_hbar(Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
char map[7] = { 32, 1, 2, 3, 4, 5 };
|
||||
static unsigned char hbar_char[5][8] = {
|
||||
{0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10},
|
||||
{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
|
||||
{0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C},
|
||||
{0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E},
|
||||
{0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}
|
||||
};
|
||||
|
||||
LB216_init_hbar(drvthis);
|
||||
if (p->custom != hbar) {
|
||||
int i;
|
||||
|
||||
for ( ; (x <= p->width) && (len > 0); x++) {
|
||||
if (len >= p->cellwidth)
|
||||
LB216_chr(drvthis, x, y, map[5]);
|
||||
else
|
||||
LB216_chr(drvthis, x, y, map[len]);
|
||||
|
||||
len -= p->cellwidth;
|
||||
for (i = 0; i < 5; i++)
|
||||
LB216_set_char(drvthis, i + 1, hbar_char[i]);
|
||||
p->custom = hbar;
|
||||
}
|
||||
lib_hbar_static(drvthis, x, y, len, promille, options, p->cellwidth, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -580,27 +431,25 @@ LB216_hbar(Driver *drvthis, int x, int y, int len)
|
||||
// The input is just an array of characters...
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
LB216_set_char(Driver *drvthis, int n, char *dat)
|
||||
LB216_set_char(Driver *drvthis, int n, unsigned char *dat)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
char out[4];
|
||||
int row, col;
|
||||
int row;
|
||||
unsigned char mask = (1 << p->cellwidth) - 1;
|
||||
|
||||
if ((n < 0) || (n > 7))
|
||||
return;
|
||||
if (!dat)
|
||||
if ((n < 0) || (n > 7) || (!dat))
|
||||
return;
|
||||
|
||||
snprintf(out, sizeof(out), "%c%c", 254, 64 + (8 * n));
|
||||
write(p->fd, out, 2);
|
||||
|
||||
for (row = 0; row < p->cellheight; row++) {
|
||||
int letter = 1;
|
||||
int letter = dat[row] & mask;
|
||||
|
||||
/* For some reason the previous implementation had the 6th bit set. */
|
||||
letter |= 0x20;
|
||||
|
||||
for (col = 0; col < p->cellwidth; col++) {
|
||||
letter <<= 1;
|
||||
letter |= (dat[(row * p->cellwidth) + col] > 0);
|
||||
}
|
||||
snprintf(out, sizeof(out), "%c", letter);
|
||||
write(p->fd, out, 1);
|
||||
}
|
||||
@@ -610,26 +459,12 @@ LB216_set_char(Driver *drvthis, int n, char *dat)
|
||||
MODULE_EXPORT int
|
||||
LB216_icon(Driver *drvthis, int x, int y, int icon)
|
||||
{
|
||||
//PrivateData *p = drvthis->private_data;
|
||||
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 unsigned char heart_open[] =
|
||||
{0x1F, 0x15, 0x00, 0x00, 0x00, 0x11, 0x1B, 0x1F};
|
||||
|
||||
static unsigned char heart_filled[] =
|
||||
{0x1F, 0x15, 0x0A, 0x0E, 0x0E, 0x15, 0x1B, 0x1F};
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef LB216_H
|
||||
#define LB216_H
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
MODULE_EXPORT int LB216_init(Driver *drvthis);
|
||||
MODULE_EXPORT void LB216_close(Driver *drvthis);
|
||||
MODULE_EXPORT int LB216_width (Driver *drvthis);
|
||||
@@ -14,12 +12,12 @@ MODULE_EXPORT void LB216_flush(Driver *drvthis);
|
||||
MODULE_EXPORT void LB216_string (Driver *drvthis, int x, int y, const char string[]);
|
||||
MODULE_EXPORT void LB216_chr(Driver *drvthis, int x, int y, char c) ;
|
||||
|
||||
MODULE_EXPORT void LB216_old_vbar(Driver *drvthis, int x, int len);
|
||||
MODULE_EXPORT void LB216_old_hbar(Driver *drvthis, int x, int y, int len);
|
||||
MODULE_EXPORT void LB216_vbar(Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||
MODULE_EXPORT void LB216_hbar(Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||
MODULE_EXPORT void LB216_num(Driver *drvthis, int x, int num);
|
||||
MODULE_EXPORT int LB216_icon(Driver *drvthis, int x, int y, int icon);
|
||||
|
||||
MODULE_EXPORT void LB216_set_char(Driver *drvthis, int n, char *dat);
|
||||
MODULE_EXPORT void LB216_set_char(Driver *drvthis, int n, unsigned char *dat);
|
||||
|
||||
MODULE_EXPORT void LB216_backlight(Driver *drvthis, int on);
|
||||
|
||||
|
||||
+78
-351
@@ -3,8 +3,6 @@
|
||||
* www.neumark.de.
|
||||
*
|
||||
* \todo Support keyboard input
|
||||
* \todo Convert to use pixel-row based logic for custom characters, icons,
|
||||
* bar graphs etc.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -45,6 +43,7 @@
|
||||
#include "lcd_lib.h"
|
||||
#include "lcterm.h"
|
||||
#include "report.h"
|
||||
#include "adv_bignum.h"
|
||||
|
||||
|
||||
/** private data for the \c lcterm driver */
|
||||
@@ -55,7 +54,7 @@ typedef struct lcterm_private_data {
|
||||
unsigned char *last_framebuf; /**< old frame buffer contents */
|
||||
int width; /**< display width in characters */
|
||||
int height; /**< display height in characters */
|
||||
int fd; /**< handle to the device */
|
||||
int fd; /**< handle to the device */
|
||||
} PrivateData;
|
||||
|
||||
|
||||
@@ -315,32 +314,40 @@ lcterm_string (Driver *drvthis, int x, int y, const char string[])
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get total number of custom characters available.
|
||||
* \param drvthis Pointer to driver structure.
|
||||
* \return Number of custom characters (always NUM_CCs).
|
||||
*/
|
||||
MODULE_EXPORT int
|
||||
lcterm_get_free_chars(Driver *drvthis)
|
||||
{
|
||||
return NUM_CCs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a custom character and write it to the LCD.
|
||||
* \param drvthis Pointer to driver structure.
|
||||
* \param n Custom character to define [0 - (NUM_CCs-1)].
|
||||
* \param dat Array of 40(=8*5=cellheight*cellwidth) bytes, each representing a pixel
|
||||
* starting from the top left to the bottom right.
|
||||
* \param dat Array of 8 (= cellheight) bytes, each representing a row in
|
||||
* CGRAM starting from the top.
|
||||
*/
|
||||
MODULE_EXPORT void
|
||||
lcterm_set_char (Driver *drvthis, int n, char *dat)
|
||||
lcterm_set_char (Driver *drvthis, int n, unsigned char *dat)
|
||||
{
|
||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||
int row, col;
|
||||
int row;
|
||||
int data;
|
||||
unsigned char buf[11];
|
||||
unsigned char mask = (1 << LCD_DEFAULT_CELLWIDTH) - 1;
|
||||
|
||||
if ((n < 0) || (n > 7) || (!dat))
|
||||
return;
|
||||
|
||||
buf[0] = 0x1F;
|
||||
buf[1] = 8 * n; // CG RAM address */
|
||||
for (row = 0; row < 8; row++) {
|
||||
data = 0;
|
||||
for (col = 0; col < 5; col++) {
|
||||
data <<= 1;
|
||||
data |= (*dat++ != 0);
|
||||
}
|
||||
for (row = 0; row < LCD_DEFAULT_CELLHEIGHT; row++) {
|
||||
data = dat[row] & mask;
|
||||
buf[2+row] = data | 0x80;
|
||||
}
|
||||
buf[10] = 0x1E; // Cursor Home - exit CG-RAM mode
|
||||
@@ -356,77 +363,17 @@ static void
|
||||
lcterm_init_vbar (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||
|
||||
static char vbar_1[] = {
|
||||
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,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char vbar_2[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char vbar_3[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char vbar_4[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char vbar_5[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char vbar_6[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char vbar_7[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
static unsigned char vbar_char[8][8] = {
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}
|
||||
};
|
||||
int i;
|
||||
|
||||
if (p->last_ccmode == vbar) /* Work already done */
|
||||
return;
|
||||
@@ -434,19 +381,14 @@ lcterm_init_vbar (Driver *drvthis)
|
||||
if (p->ccmode != standard) {
|
||||
/* Not supported (yet) */
|
||||
report(RPT_WARNING, "%s: init_vbar: cannot combine two modes using user-defined characters",
|
||||
drvthis->name);
|
||||
drvthis->name);
|
||||
return;
|
||||
}
|
||||
|
||||
p->ccmode = p->last_ccmode = vbar;
|
||||
|
||||
lcterm_set_char(drvthis, 1, vbar_1);
|
||||
lcterm_set_char(drvthis, 2, vbar_2);
|
||||
lcterm_set_char(drvthis, 3, vbar_3);
|
||||
lcterm_set_char(drvthis, 4, vbar_4);
|
||||
lcterm_set_char(drvthis, 5, vbar_5);
|
||||
lcterm_set_char(drvthis, 6, vbar_6);
|
||||
lcterm_set_char(drvthis, 7, vbar_7);
|
||||
for (i = 0; i < 8; i++)
|
||||
lcterm_set_char(drvthis, i + 1, vbar_char[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -458,56 +400,13 @@ static void
|
||||
lcterm_init_hbar (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||
|
||||
static char hbar_1[] = {
|
||||
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,
|
||||
1, 0, 0, 0, 0,
|
||||
};
|
||||
static char hbar_2[] = {
|
||||
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,
|
||||
1, 1, 0, 0, 0,
|
||||
};
|
||||
static char hbar_3[] = {
|
||||
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,
|
||||
1, 1, 1, 0, 0,
|
||||
};
|
||||
static char hbar_4[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 0,
|
||||
};
|
||||
static char hbar_5[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1,
|
||||
int i;
|
||||
static unsigned char hbar_char[5][8] = {
|
||||
{0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10},
|
||||
{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
|
||||
{0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C},
|
||||
{0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E},
|
||||
{0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}
|
||||
};
|
||||
|
||||
if (p->last_ccmode == hbar) /* Work already done */
|
||||
@@ -516,17 +415,14 @@ lcterm_init_hbar (Driver *drvthis)
|
||||
if (p->ccmode != standard) {
|
||||
/* Not supported (yet) */
|
||||
report(RPT_WARNING, "%s: init_hbar: cannot combine two modes using user-defined characters",
|
||||
drvthis->name);
|
||||
drvthis->name);
|
||||
return;
|
||||
}
|
||||
|
||||
p->ccmode = p->last_ccmode = hbar;
|
||||
|
||||
lcterm_set_char(drvthis, 1, hbar_1);
|
||||
lcterm_set_char(drvthis, 2, hbar_2);
|
||||
lcterm_set_char(drvthis, 3, hbar_3);
|
||||
lcterm_set_char(drvthis, 4, hbar_4);
|
||||
lcterm_set_char(drvthis, 5, hbar_5);
|
||||
for (i = 0; i < 5; i++)
|
||||
lcterm_set_char(drvthis, i + 1, hbar_char[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -564,109 +460,6 @@ lcterm_hbar(Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets up for big numbers.
|
||||
* \param drvthis Pointer to driver structure.
|
||||
*/
|
||||
static void
|
||||
lcterm_init_num (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||
int i;
|
||||
|
||||
static char bignum_ccs[8][5*8] = {{
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 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, 0, 1, 1,
|
||||
0, 0, 0, 1, 1,
|
||||
0, 0, 0, 1, 1,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0
|
||||
}, {
|
||||
1, 1, 0, 1, 1,
|
||||
1, 1, 0, 1, 1,
|
||||
1, 1, 0, 1, 1,
|
||||
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,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0
|
||||
}, {
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 1,
|
||||
0, 0, 0, 1, 1,
|
||||
0, 0, 0, 1, 1,
|
||||
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, 0, 1, 1,
|
||||
1, 1, 0, 1, 1,
|
||||
1, 1, 0, 1, 1,
|
||||
0, 0, 0, 0, 0
|
||||
}, {
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
1, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0
|
||||
}, {
|
||||
0, 0, 0, 1, 1,
|
||||
0, 0, 0, 1, 1,
|
||||
0, 0, 0, 1, 1,
|
||||
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
|
||||
}};
|
||||
|
||||
if (p->last_ccmode == bignum) {
|
||||
/* Work already done */
|
||||
return;
|
||||
}
|
||||
|
||||
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 = p->last_ccmode = bignum;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
lcterm_set_char(drvthis, i, bignum_ccs[i]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write a big number to the screen.
|
||||
* \param drvthis Pointer to driver structure.
|
||||
@@ -677,95 +470,28 @@ MODULE_EXPORT void
|
||||
lcterm_num (Driver *drvthis, int x, int num)
|
||||
{
|
||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||
|
||||
static 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: */
|
||||
{32},
|
||||
{7},
|
||||
{7},
|
||||
{32}
|
||||
}};
|
||||
int do_init = 0;
|
||||
|
||||
if ((num < 0) || (num > 10))
|
||||
return;
|
||||
|
||||
if (p->height >= 4) {
|
||||
int y = (p->height - 2) / 2;
|
||||
int x2, y2;
|
||||
if (p->height >= 4) { /* Use standard bignum library */
|
||||
if (p->last_ccmode != bignum) {
|
||||
if (p->ccmode != standard) {
|
||||
report(RPT_WARNING, "%s: num: cannot combine two modes using user-defined characters",
|
||||
drvthis->name);
|
||||
return;
|
||||
}
|
||||
|
||||
lcterm_init_num(drvthis);
|
||||
|
||||
for (x2 = 0; x2 <= 2; x2++) {
|
||||
for (y2 = 0; y2 <= 3; y2++) {
|
||||
lcterm_chr(drvthis, x+x2, y+y2, bignum_map[num][y2][x2]);
|
||||
}
|
||||
if (num == 10)
|
||||
x2 = 2; /* =break, for colon only */
|
||||
p->ccmode = p->last_ccmode = bignum;
|
||||
do_init = 1;
|
||||
}
|
||||
|
||||
lib_adv_bignum(drvthis, x, num, 0, do_init);
|
||||
}
|
||||
else { /* Roll our own 'mini big numbers' */
|
||||
lcterm_chr(drvthis, x, 1 + (p->height - 1) / 2, (num == 10) ? ':' : (num + '0'));
|
||||
}
|
||||
else
|
||||
lcterm_chr(drvthis, x, 1 + (p->height - 1) / 2,
|
||||
(num == 10) ? ':' : (num + '0'));
|
||||
}
|
||||
|
||||
|
||||
@@ -781,25 +507,27 @@ lcterm_num (Driver *drvthis, int x, int num)
|
||||
MODULE_EXPORT int
|
||||
lcterm_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 unsigned char heart_open[] = {
|
||||
b__XXXXX,
|
||||
b__X_X_X,
|
||||
b_______,
|
||||
b_______,
|
||||
b_______,
|
||||
b__X___X,
|
||||
b__XX_XX,
|
||||
b__XXXXX
|
||||
};
|
||||
|
||||
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 };
|
||||
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
|
||||
};
|
||||
|
||||
switch (icon)
|
||||
{
|
||||
@@ -819,4 +547,3 @@ lcterm_icon (Driver *drvthis, int x, int y, int icon)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#ifndef LCTERM_H
|
||||
#define LCTERM_H
|
||||
|
||||
#include "lcd.h"
|
||||
MODULE_EXPORT int lcterm_init (Driver *drvthis);
|
||||
MODULE_EXPORT void lcterm_close (Driver *drvthis);
|
||||
MODULE_EXPORT int lcterm_width (Driver *drvthis);
|
||||
@@ -40,9 +39,11 @@ MODULE_EXPORT void lcterm_vbar (Driver *drvthis, int x, int y, int len, int prom
|
||||
MODULE_EXPORT void lcterm_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||
MODULE_EXPORT void lcterm_num (Driver *drvthis, int x, int num);
|
||||
MODULE_EXPORT int lcterm_icon (Driver *drvthis, int x, int y, int icon);
|
||||
MODULE_EXPORT void lcterm_set_char (Driver *drvthis, int n, char *dat);
|
||||
MODULE_EXPORT void lcterm_set_char (Driver *drvthis, int n, unsigned char *dat);
|
||||
MODULE_EXPORT int lcterm_get_free_chars(Driver *drvthis);
|
||||
|
||||
#define DEFAULT_DEVICE "/dev/lcd"
|
||||
#define NUM_CCs 8
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+35
-166
@@ -1,7 +1,5 @@
|
||||
/** \file server/drivers/mtc_s16209x.c
|
||||
* LCDd \c mtc_s16209x driver for the MTC_S16209x LCD display by Microtips Technology Inc.
|
||||
*
|
||||
* \todo Convert to new style hbar and vbar!
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -440,85 +438,21 @@ static void
|
||||
MTC_S16209X_init_vbar (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
static 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,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static 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,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char c[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char d[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char e[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char f[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
};
|
||||
static char g[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
static unsigned char vbar_char[7][8] = {
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}
|
||||
};
|
||||
|
||||
if (p->custom != vbar) {
|
||||
MTC_S16209X_set_char(drvthis, 1, a);
|
||||
MTC_S16209X_set_char(drvthis, 2, b);
|
||||
MTC_S16209X_set_char(drvthis, 3, c);
|
||||
MTC_S16209X_set_char(drvthis, 4, d);
|
||||
MTC_S16209X_set_char(drvthis, 5, e);
|
||||
MTC_S16209X_set_char(drvthis, 6, f);
|
||||
MTC_S16209X_set_char(drvthis, 7, g);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
MTC_S16209X_set_char(drvthis, i + 1, vbar_char[i]);
|
||||
p->custom = vbar;
|
||||
}
|
||||
}
|
||||
@@ -530,63 +464,17 @@ static void
|
||||
MTC_S16209X_init_hbar (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
static 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,
|
||||
1, 0, 0, 0, 0,
|
||||
};
|
||||
static 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,
|
||||
1, 1, 0, 0, 0,
|
||||
};
|
||||
static 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,
|
||||
1, 1, 1, 0, 0,
|
||||
};
|
||||
static 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,
|
||||
1, 1, 1, 1, 0,
|
||||
};
|
||||
static char e[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1,
|
||||
static unsigned char hbar_char[5][8] = {
|
||||
{0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10},
|
||||
{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
|
||||
{0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C},
|
||||
{0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E}
|
||||
};
|
||||
|
||||
if (p->custom != hbar) {
|
||||
MTC_S16209X_set_char(drvthis, 1, a);
|
||||
MTC_S16209X_set_char(drvthis, 2, b);
|
||||
MTC_S16209X_set_char(drvthis, 3, c);
|
||||
MTC_S16209X_set_char(drvthis, 4, d);
|
||||
MTC_S16209X_set_char(drvthis, 5, e);
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
MTC_S16209X_set_char(drvthis, i + 1, hbar_char[i]);
|
||||
p->custom = hbar;
|
||||
}
|
||||
}
|
||||
@@ -626,18 +514,15 @@ MTC_S16209X_hbar (Driver *drvthis, int x, int y, int len, int promille, int opti
|
||||
// The input is just an array of characters...
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
MTC_S16209X_set_char (Driver *drvthis, int n, char *dat)
|
||||
MTC_S16209X_set_char (Driver *drvthis, int n, unsigned char *dat)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
char out[4];
|
||||
int row, col;
|
||||
int row;
|
||||
int letter;
|
||||
unsigned char mask = (1 << p->cellwidth) - 1;
|
||||
|
||||
//return (0);
|
||||
|
||||
if ((n < 0) || (n > 7))
|
||||
return;
|
||||
if (!dat)
|
||||
if ((n < 0) || (n > 7) || (!dat))
|
||||
return;
|
||||
|
||||
snprintf(out, sizeof(out), "%c%c", 0xFE, 64 + (8 * n));
|
||||
@@ -646,12 +531,13 @@ MTC_S16209X_set_char (Driver *drvthis, int n, char *dat)
|
||||
flock(p->fd, LOCK_UN);
|
||||
|
||||
for (row = 0; row < p->cellheight; row++) {
|
||||
letter = 1;
|
||||
letter = dat[row] & mask;
|
||||
|
||||
for (col = 0; col < p->cellwidth; col++) {
|
||||
letter <<= 1;
|
||||
letter |= (dat[(row * p->cellwidth) + col] > 0);
|
||||
}
|
||||
/*
|
||||
* For some reason the previous implementation had the 6th bit set. As
|
||||
* I have no idea what this was supposed to be good for set it, too.
|
||||
*/
|
||||
letter |= 0x20;
|
||||
|
||||
snprintf(out, sizeof (out), "%c", letter);
|
||||
|
||||
@@ -664,27 +550,11 @@ MTC_S16209X_set_char (Driver *drvthis, int n, char *dat)
|
||||
MODULE_EXPORT int
|
||||
MTC_S16209X_icon (Driver *drvthis, int x, int y, int icon)
|
||||
{
|
||||
//PrivateData *p = drvthis->private_data;
|
||||
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
|
||||
};
|
||||
static unsigned char heart_open[] =
|
||||
{0x1F, 0x15, 0x00, 0x00, 0x00, 0x11, 0x1B, 0x1F};
|
||||
|
||||
static unsigned char heart_filled[] =
|
||||
{0x1F, 0x15, 0x0A, 0x0E, 0x0E, 0x15, 0x1B, 0x1F};
|
||||
|
||||
switch (icon) {
|
||||
case ICON_BLOCK_FILLED:
|
||||
@@ -703,4 +573,3 @@ MTC_S16209X_icon (Driver *drvthis, int x, int y, int icon)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ MODULE_EXPORT void MTC_S16209X_vbar(Driver *drvthis, int x, int y, int len, int
|
||||
MODULE_EXPORT void MTC_S16209X_hbar(Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||
MODULE_EXPORT int MTC_S16209X_icon(Driver *drvthis, int x, int y, int icon);
|
||||
|
||||
MODULE_EXPORT void MTC_S16209X_set_char(Driver *drvthis, int n, char *dat);
|
||||
MODULE_EXPORT void MTC_S16209X_set_char(Driver *drvthis, int n, unsigned char *dat);
|
||||
|
||||
MODULE_EXPORT void MTC_S16209X_backlight(Driver *drvthis, int on);
|
||||
|
||||
|
||||
+27
-176
@@ -1,7 +1,5 @@
|
||||
/** \file server/drivers/wirz-sli.c
|
||||
* LCDd \c sli driver for the SLI devices by Wirz, http://www.wirz.com/.
|
||||
*
|
||||
* \todo Convert to new style hbar and vbar!
|
||||
*/
|
||||
|
||||
/* wirz-sli.c -- Source file for LCDproc Wirz SLI driver
|
||||
@@ -306,85 +304,20 @@ static void
|
||||
sli_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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
};
|
||||
char g[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
static unsigned char vbar_char[7][8] = {
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F},
|
||||
{0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}
|
||||
};
|
||||
|
||||
if (p->custom != vbar) {
|
||||
sli_set_char(drvthis, 1, a);
|
||||
sli_set_char(drvthis, 2, b);
|
||||
sli_set_char(drvthis, 3, c);
|
||||
sli_set_char(drvthis, 4, d);
|
||||
sli_set_char(drvthis, 5, e);
|
||||
sli_set_char(drvthis, 6, f);
|
||||
sli_set_char(drvthis, 7, g);
|
||||
int i;
|
||||
for (i = 0; i < 7; i++)
|
||||
sli_set_char(drvthis, i + 1, vbar_char[i]);
|
||||
p->custom = vbar;
|
||||
}
|
||||
}
|
||||
@@ -396,63 +329,17 @@ static void
|
||||
sli_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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
1, 1, 1, 1, 0,
|
||||
};
|
||||
char e[] = {
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1,
|
||||
static unsigned char hbar_char[4][8] = {
|
||||
{0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10},
|
||||
{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
|
||||
{0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C},
|
||||
{0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E},
|
||||
};
|
||||
|
||||
if (p->custom != hbar) {
|
||||
sli_set_char(drvthis, 1, a);
|
||||
sli_set_char(drvthis, 2, b);
|
||||
sli_set_char(drvthis, 3, c);
|
||||
sli_set_char(drvthis, 4, d);
|
||||
sli_set_char(drvthis, 5, e);
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
sli_set_char(drvthis, i + 1, hbar_char[i]);
|
||||
p->custom = hbar;
|
||||
}
|
||||
}
|
||||
@@ -497,16 +384,15 @@ sli_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
// The input is just an array of characters...
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
sli_set_char (Driver *drvthis, int n, char *dat)
|
||||
sli_set_char (Driver *drvthis, int n, unsigned char *dat)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
char out[2];
|
||||
int row, col;
|
||||
int row;
|
||||
unsigned char mask = (1 << p->cellwidth) - 1;
|
||||
|
||||
/* SLI also has 8 user definable characters */
|
||||
if ((n < 0) || (n > 7))
|
||||
return;
|
||||
if (!dat)
|
||||
if ((n < 0) || (n > 7) || (!dat))
|
||||
return;
|
||||
|
||||
/* Move cursor to CGRAM */
|
||||
@@ -515,12 +401,8 @@ sli_set_char (Driver *drvthis, int n, char *dat)
|
||||
write(p->fd, out, 2);
|
||||
|
||||
for (row = 0; row < p->cellheight; row++) {
|
||||
int letter = 0;
|
||||
int letter = dat[row] & mask;
|
||||
|
||||
for (col = 0; col < p->cellwidth; col++) {
|
||||
letter <<= 1;
|
||||
letter |= (dat[(row * p->cellwidth) + col] > 0);
|
||||
}
|
||||
letter |= 0x020; /* SLI can't accept CR, LF, etc in this character! */
|
||||
write(p->fd, &letter, 1);
|
||||
}
|
||||
@@ -534,40 +416,9 @@ sli_set_char (Driver *drvthis, int n, char *dat)
|
||||
MODULE_EXPORT int
|
||||
sli_icon (Driver *drvthis, int x, int y, int icon)
|
||||
{
|
||||
static char icons[3][5 * 8] = {
|
||||
{
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
},
|
||||
|
||||
{
|
||||
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,
|
||||
1, 1, 1, 1, 1,
|
||||
},
|
||||
|
||||
{
|
||||
0, 0, 0, 0, 0, // Ellipsis
|
||||
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, 0, 1, 0, 1,
|
||||
},
|
||||
|
||||
static unsigned char icons[2][8] = {
|
||||
{0x1F, 0x15, 0x00, 0x00, 0x00, 0x11, 0x1B, 0x1F}, /* Empty Heart */
|
||||
{0x1F, 0x15, 0x0A, 0x0E, 0x0E, 0x15, 0x1B, 0x1F} /* Filled Heart */
|
||||
};
|
||||
|
||||
switch (icon) {
|
||||
|
||||
@@ -24,6 +24,6 @@ MODULE_EXPORT void sli_vbar (Driver *drvthis, int x, int y, int len, int promill
|
||||
MODULE_EXPORT void sli_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||
MODULE_EXPORT int sli_icon (Driver *drvthis, int x, int y, int icon);
|
||||
|
||||
MODULE_EXPORT void sli_set_char (Driver *drvthis, int n, char *dat);
|
||||
MODULE_EXPORT void sli_set_char (Driver *drvthis, int n, unsigned char *dat);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user