lots of little fixes for harmonizing it with CFontz633.c

This commit is contained in:
marschap
2005-05-29 17:59:43 +00:00
parent 775ac47a30
commit 9e7c90d1ef
+105 -103
View File
@@ -38,7 +38,7 @@
* Driver status * Driver status
* 04/04/2002: Working driver * 04/04/2002: Working driver
* 05/06/2002: Reading of return value * 05/06/2002: Reading of return value
* 02/09/2002: KeyPad handeling and return string * 02/09/2002: KeyPad handling and return string
* 03/09/2002: New icon incorporated * 03/09/2002: New icon incorporated
* 27/01/2003: Adapted for CFontz 631 * 27/01/2003: Adapted for CFontz 631
* 16/05/2005: Adapted for CFontz 635 * 16/05/2005: Adapted for CFontz 635
@@ -53,7 +53,6 @@
* + Stopping the live reporting (of temperature) * + Stopping the live reporting (of temperature)
* + Stopping the reporting of temp and fan (is it necessary after reboot) * + Stopping the reporting of temp and fan (is it necessary after reboot)
* + Use of library for hbar and vbar (good but library could be better) * + Use of library for hbar and vbar (good but library could be better)
* + Support for keypad (Using a KeyRing)
* *
* THINGS TO DO: * THINGS TO DO:
* + Make the caching at least for heartbeat icon * + Make the caching at least for heartbeat icon
@@ -106,6 +105,7 @@
#define CELLWIDTH DEFAULT_CELL_WIDTH #define CELLWIDTH DEFAULT_CELL_WIDTH
#define CELLHEIGHT DEFAULT_CELL_HEIGHT #define CELLHEIGHT DEFAULT_CELL_HEIGHT
/* Constants for userdefchar_mode */ /* Constants for userdefchar_mode */
#define NUM_CCs 8 /* max. number of custom characters */ #define NUM_CCs 8 /* max. number of custom characters */
@@ -135,7 +135,7 @@ typedef struct driver_private_data {
int width, height; int width, height;
int cellwidth, cellheight; int cellwidth, cellheight;
/* framebuffer and buffer for backingstore LCD contents */ /* framebuffer and buffer for old LCD contents */
unsigned char *framebuf; unsigned char *framebuf;
unsigned char *backingstore; unsigned char *backingstore;
@@ -148,6 +148,7 @@ typedef struct driver_private_data {
int offbrightness; int offbrightness;
} PrivateData; } PrivateData;
/* Vars for the server core */ /* Vars for the server core */
MODULE_EXPORT char *api_version = API_VERSION; MODULE_EXPORT char *api_version = API_VERSION;
MODULE_EXPORT int stay_in_foreground = 0; MODULE_EXPORT int stay_in_foreground = 0;
@@ -159,17 +160,17 @@ MODULE_EXPORT char *symbol_prefix = "CFontz633_";
/* static void CFontz633_autoscroll (int on); */ /* static void CFontz633_autoscroll (int on); */
static void CFontz633_hidecursor (Driver *drvthis); static void CFontz633_hidecursor (Driver *drvthis);
static void CFontz633_reboot (Driver *drvthis); static void CFontz633_reboot (Driver *drvthis);
static void CFontz633_init_vbar (Driver * drvthis); static void CFontz633_init_vbar (Driver *drvthis);
static void CFontz633_init_hbar (Driver * drvthis); static void CFontz633_init_hbar (Driver *drvthis);
static void CFontz633_no_live_report (Driver *drvthis); static void CFontz633_no_live_report (Driver *drvthis);
static void CFontz633_hardware_clear (Driver * drvthis); static void CFontz633_hardware_clear (Driver *drvthis);
/* /*
* Opens com port and sets baud correctly... * Opens com port and sets baud correctly...
*/ */
MODULE_EXPORT int MODULE_EXPORT int
CFontz633_init (Driver * drvthis, char *args) CFontz633_init (Driver *drvthis, char *args)
{ {
struct termios portset; struct termios portset;
int tmp, w, h; int tmp, w, h;
@@ -189,9 +190,9 @@ CFontz633_init (Driver * drvthis, char *args)
return -1; return -1;
/* Initialize the PrivateData structure */ /* Initialize the PrivateData structure */
p->cellwidth = DEFAULT_CELL_WIDTH; p->cellwidth = DEFAULT_CELL_WIDTH;
p->cellheight = DEFAULT_CELL_HEIGHT; p->cellheight = DEFAULT_CELL_HEIGHT;
p->ccmode = standard;
debug(RPT_INFO, "CFontz633: init(%p,%s)", drvthis, args ); debug(RPT_INFO, "CFontz633: init(%p,%s)", drvthis, args );
@@ -200,7 +201,7 @@ CFontz633_init (Driver * drvthis, char *args)
/* Read config file */ /* Read config file */
/* Which model is it (CF633 or CF631)? */ /* Which model is it (CF633 or CF631)? */
tmp = drvthis->config_get_int ( drvthis->name , "Model" , 0, DEFAULT_SPEED); tmp = drvthis->config_get_int (drvthis->name, "Model", 0, DEFAULT_SPEED);
debug (RPT_INFO,"CFontzPacket_init: Model is '%d'", tmp); debug (RPT_INFO,"CFontzPacket_init: Model is '%d'", tmp);
if ((tmp != 631) && (tmp != 633) && (tmp != 635)) { if ((tmp != 631) && (tmp != 633) && (tmp != 635)) {
tmp = 633; tmp = 633;
@@ -208,8 +209,8 @@ CFontz633_init (Driver * drvthis, char *args)
} }
p->model = tmp; p->model = tmp;
/* Which serial device should be used */ /* Which device should be used */
strncpy(p->device, drvthis->config_get_string ( drvthis->name , "Device" , 0 , DEFAULT_DEVICE), sizeof(p->device)); strncpy(p->device, drvthis->config_get_string (drvthis->name, "Device", 0, DEFAULT_DEVICE), sizeof(p->device));
p->device[sizeof(p->device)-1] = '\0'; p->device[sizeof(p->device)-1] = '\0';
debug (RPT_INFO,"CFontzPacket_init: Device (in config) is '%s'", p->device); debug (RPT_INFO,"CFontzPacket_init: Device (in config) is '%s'", p->device);
@@ -221,12 +222,12 @@ CFontz633_init (Driver * drvthis, char *args)
else if (p->model == 635) else if (p->model == 635)
default_size = DEFAULT_SIZE_CF635; default_size = DEFAULT_SIZE_CF635;
strncpy(size, drvthis->config_get_string ( drvthis->name , "Size" , 0 , default_size), sizeof(size)); strncpy(size, drvthis->config_get_string (drvthis->name, "Size", 0, default_size), sizeof(size));
size[sizeof(size)-1] = '\0'; size[sizeof(size)-1] = '\0';
debug (RPT_INFO,"CFontzPacket_init: Size (in config) is '%s'", size); debug (RPT_INFO,"CFontzPacket_init: Size (in config) is '%s'", size);
if( sscanf(size , "%dx%d", &w, &h ) != 2 if ((sscanf(size, "%dx%d", &w, &h ) != 2)
|| (w <= 0) || (w > LCD_MAX_WIDTH) || (w <= 0) || (w > LCD_MAX_WIDTH)
|| (h <= 0) || (h > LCD_MAX_HEIGHT)) { || (h <= 0) || (h > LCD_MAX_HEIGHT)) {
report (RPT_WARNING, "CFontzPacket_init: Cannot read size: %s. Using default value.\n", size); report (RPT_WARNING, "CFontzPacket_init: Cannot read size: %s. Using default value.\n", size);
sscanf( default_size, "%dx%d", &w, &h ); sscanf( default_size, "%dx%d", &w, &h );
} }
@@ -236,7 +237,7 @@ CFontz633_init (Driver * drvthis, char *args)
debug (RPT_INFO,"CFontzPacket_init: Real size used: %dx%d", p->width, p->height); debug (RPT_INFO,"CFontzPacket_init: Real size used: %dx%d", p->width, p->height);
/* Which contrast */ /* Which contrast */
tmp = drvthis->config_get_int ( drvthis->name , "Contrast" , 0 , DEFAULT_CONTRAST); tmp = drvthis->config_get_int (drvthis->name, "Contrast", 0, DEFAULT_CONTRAST);
debug (RPT_INFO,"CFontzPacket_init: Contrast (in config) is '%d'", tmp); debug (RPT_INFO,"CFontzPacket_init: Contrast (in config) is '%d'", tmp);
if ((tmp < 0) || (tmp > 1000)) { if ((tmp < 0) || (tmp > 1000)) {
report (RPT_WARNING, "CFontzPacket_init: Contrast must be between 0 and 1000. Using default value.\n"); report (RPT_WARNING, "CFontzPacket_init: Contrast must be between 0 and 1000. Using default value.\n");
@@ -245,7 +246,7 @@ CFontz633_init (Driver * drvthis, char *args)
p->contrast = tmp; p->contrast = tmp;
/* Which backlight brightness */ /* Which backlight brightness */
tmp = drvthis->config_get_int ( drvthis->name , "Brightness" , 0 , DEFAULT_BRIGHTNESS); tmp = drvthis->config_get_int (drvthis->name, "Brightness", 0, DEFAULT_BRIGHTNESS);
debug (RPT_INFO,"CFontzPacket_init: Brightness (in config) is '%d'", tmp); debug (RPT_INFO,"CFontzPacket_init: Brightness (in config) is '%d'", tmp);
if ((tmp < 0) || (tmp > 100)) { if ((tmp < 0) || (tmp > 100)) {
report (RPT_WARNING, "CFontzPacket_init: Brightness must be between 0 and 100. Using default value.\n"); report (RPT_WARNING, "CFontzPacket_init: Brightness must be between 0 and 100. Using default value.\n");
@@ -254,7 +255,7 @@ CFontz633_init (Driver * drvthis, char *args)
p->brightness = tmp; p->brightness = tmp;
/* Which backlight-off "brightness" */ /* Which backlight-off "brightness" */
tmp = drvthis->config_get_int ( drvthis->name , "OffBrightness" , 0 , DEFAULT_OFFBRIGHTNESS); tmp = drvthis->config_get_int (drvthis->name, "OffBrightness", 0, DEFAULT_OFFBRIGHTNESS);
debug (RPT_INFO,"CFontzPacket_init: OffBrightness (in config) is '%d'", tmp); debug (RPT_INFO,"CFontzPacket_init: OffBrightness (in config) is '%d'", tmp);
if ((tmp < 0) || (tmp > 100)) { if ((tmp < 0) || (tmp > 100)) {
report (RPT_WARNING, "CFontzPacket_init: OffBrightness must be between 0 and 100. Using default value.\n"); report (RPT_WARNING, "CFontzPacket_init: OffBrightness must be between 0 and 100. Using default value.\n");
@@ -263,7 +264,7 @@ CFontz633_init (Driver * drvthis, char *args)
p->offbrightness = tmp; p->offbrightness = tmp;
/* Which speed CF633 support 19200 only, CF631USB use 115200. */ /* Which speed CF633 support 19200 only, CF631USB use 115200. */
tmp = drvthis->config_get_int ( drvthis->name , "Speed" , 0 , DEFAULT_SPEED); tmp = drvthis->config_get_int (drvthis->name, "Speed", 0, DEFAULT_SPEED);
debug (RPT_INFO,"CFontzPacket_init: Speed (in config) is '%d'", tmp); debug (RPT_INFO,"CFontzPacket_init: Speed (in config) is '%d'", tmp);
if (tmp == 19200) speed = B19200; if (tmp == 19200) speed = B19200;
else if (tmp == 115200) speed = B115200; else if (tmp == 115200) speed = B115200;
@@ -274,19 +275,19 @@ CFontz633_init (Driver * drvthis, char *args)
* I will try to behave differently for firmware 0.6 or above. * I will try to behave differently for firmware 0.6 or above.
* Currently this is not in use. * Currently this is not in use.
*/ */
p->newfirmware = drvthis->config_get_bool( drvthis->name , "NewFirmware" , 0 , 0); p->newfirmware = drvthis->config_get_bool(drvthis->name, "NewFirmware", 0, 0);
/* Reboot display? */ /* Reboot display? */
reboot = drvthis->config_get_bool( drvthis->name , "Reboot" , 0 , 0); reboot = drvthis->config_get_bool(drvthis->name, "Reboot", 0, 0);
/* Am I USB or not? */ /* Am I USB or not? */
usb = drvthis->config_get_bool( drvthis->name , "USB" , 0 , 0); usb = drvthis->config_get_bool(drvthis->name, "USB", 0, 0);
if (usb) if (usb)
report (RPT_INFO, "CFontzPacket_init: USB is indicated (in config).\n"); report (RPT_INFO, "CFontzPacket_init: USB is indicated (in config).\n");
/* Set up io port correctly, and open it... */ /* Set up io port correctly, and open it... */
debug( RPT_DEBUG, "CFontzPacket_init: Opening the device: %s", p->device); debug( RPT_DEBUG, "CFontzPacket_init: Opening device: %s", p->device);
p->fd = open(p->device, (usb) ? (O_RDWR | O_NOCTTY) : (O_RDWR | O_NOCTTY | O_NDELAY)); p->fd = open(p->device, (usb) ? (O_RDWR | O_NOCTTY) : (O_RDWR | O_NOCTTY | O_NDELAY));
if (p->fd == -1) { if (p->fd == -1) {
report (RPT_ERR, "CFontzPacket_init: failed (%s)\n", strerror (errno)); report (RPT_ERR, "CFontzPacket_init: failed (%s)\n", strerror (errno));
return -1; return -1;
@@ -327,7 +328,7 @@ CFontz633_init (Driver * drvthis, char *args)
/* Do it... */ /* Do it... */
tcsetattr (p->fd, TCSANOW, &portset); tcsetattr (p->fd, TCSANOW, &portset);
/* Make sure the frame buffer is there... */ /* make sure the frame buffer is there... */
p->framebuf = (unsigned char *) malloc(p->width * p->height); p->framebuf = (unsigned char *) malloc(p->width * p->height);
if (p->framebuf == NULL) { if (p->framebuf == NULL) {
report(RPT_ERR, "CFontzPacket_init: unable to create framebuffer.\n"); report(RPT_ERR, "CFontzPacket_init: unable to create framebuffer.\n");
@@ -335,7 +336,7 @@ CFontz633_init (Driver * drvthis, char *args)
} }
memset(p->framebuf, ' ', p->width * p->height); memset(p->framebuf, ' ', p->width * p->height);
/* Make sure the framebuffer backing store is there... */ /* make sure the framebuffer backing store is there... */
p->backingstore = (unsigned char *) malloc(p->width * p->height); p->backingstore = (unsigned char *) malloc(p->width * p->height);
if (p->backingstore == NULL) { if (p->backingstore == NULL) {
report(RPT_ERR, "CFontzPacket_init: unable to create framebuffer backing store.\n"); report(RPT_ERR, "CFontzPacket_init: unable to create framebuffer backing store.\n");
@@ -348,7 +349,6 @@ CFontz633_init (Driver * drvthis, char *args)
debug(RPT_INFO, "CFontzPacket: reboot requested\n" ); debug(RPT_INFO, "CFontzPacket: reboot requested\n" );
CFontz633_reboot (drvthis); CFontz633_reboot (drvthis);
reboot = 0; reboot = 0;
sleep (2);
debug(RPT_INFO, "CFontzPacket: reboot done" ); debug(RPT_INFO, "CFontzPacket: reboot done" );
} }
@@ -368,20 +368,23 @@ CFontz633_init (Driver * drvthis, char *args)
* Clean-up * Clean-up
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_close (Driver * drvthis) CFontz633_close (Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
if (p->framebuf) if (p != NULL) {
free(p->framebuf); close(p->fd);
p->framebuf = NULL;
if (p->backingstore) if (p->framebuf)
free(p->backingstore); free(p->framebuf);
p->backingstore = NULL; p->framebuf = NULL;
if (p->backingstore)
free(p->backingstore);
p->backingstore = NULL;
if (p != NULL)
free(p); free(p);
}
drvthis->store_private_ptr(drvthis, NULL); drvthis->store_private_ptr(drvthis, NULL);
} }
@@ -414,7 +417,7 @@ CFontz633_height (Driver *drvthis)
* Flushes all output to the lcd... * Flushes all output to the lcd...
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_flush (Driver * drvthis) CFontz633_flush (Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
int i,j; int i,j;
@@ -499,41 +502,42 @@ CFontz633_flush (Driver * drvthis)
MODULE_EXPORT char * MODULE_EXPORT char *
CFontz633_get_key (Driver *drvthis) CFontz633_get_key (Driver *drvthis)
{ {
unsigned char akey; PrivateData *p = drvthis->private_data;
unsigned char key;
akey = GetKeyFromKeyRing(); key = GetKeyFromKeyRing(&p->keyring);
switch(akey) { switch (key) {
case CF633_KEY_LEFT: case CF633_KEY_LEFT:
return "Left"; return "Left";
break; break;
case CF633_KEY_UP: case CF633_KEY_UP:
return "Up"; return "Up";
break; break;
case CF633_KEY_DOWN: case CF633_KEY_DOWN:
return "Down"; return "Down";
break; break;
case CF633_KEY_RIGHT: case CF633_KEY_RIGHT:
return "Right"; return "Right";
break; break;
case CF633_KEY_ENTER: case CF633_KEY_ENTER:
return "Enter"; return "Enter";
break; break;
case CF633_KEY_ESCAPE: case CF633_KEY_ESCAPE:
return "Escape"; return "Escape";
break; break;
case CF631_KEY_UL_PRESS: case CF631_KEY_UL_PRESS:
return "Up"; return "Up";
break; break;
case CF631_KEY_UR_PRESS: case CF631_KEY_UR_PRESS:
return "Enter"; return "Enter";
break; break;
case CF631_KEY_LL_PRESS: case CF631_KEY_LL_PRESS:
return "Down"; return "Down";
break; break;
case CF631_KEY_LR_PRESS: case CF631_KEY_LR_PRESS:
return "Escape"; return "Escape";
break; break;
case CF633_KEY_UP_RELEASE: case CF633_KEY_UP_RELEASE:
case CF633_KEY_DOWN_RELEASE: case CF633_KEY_DOWN_RELEASE:
case CF633_KEY_LEFT_RELEASE: case CF633_KEY_LEFT_RELEASE:
@@ -544,15 +548,15 @@ CFontz633_get_key (Driver *drvthis)
case CF631_KEY_UR_RELEASE: case CF631_KEY_UR_RELEASE:
case CF631_KEY_LL_RELEASE: case CF631_KEY_LL_RELEASE:
case CF631_KEY_LR_RELEASE: case CF631_KEY_LR_RELEASE:
// report( RPT_INFO, "cfontz633: Returning key 0x%2x", akey); // report( RPT_INFO, "cfontz633: Returning key release 0x%2x", key);
return NULL; return NULL;
break; break;
default:
default: if (key != '\0')
// report( RPT_INFO, "cfontz633: Untreated key 0x%2x", akey); report( RPT_INFO, "cfontz633: Untreated unknown key 0x%2x", key);
return NULL; return NULL;
break; break;
} }
return NULL; return NULL;
} }
@@ -562,7 +566,7 @@ CFontz633_get_key (Driver *drvthis)
* The upper-left is (1,1), and the lower right should be (16,2). * The upper-left is (1,1), and the lower right should be (16,2).
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_chr (Driver * drvthis, int x, int y, char c) CFontz633_chr (Driver *drvthis, int x, int y, char c)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
@@ -580,7 +584,7 @@ CFontz633_chr (Driver * drvthis, int x, int y, char c)
* Value 0 to 1000. * Value 0 to 1000.
*/ */
MODULE_EXPORT int MODULE_EXPORT int
CFontz633_get_contrast (Driver * drvthis) CFontz633_get_contrast (Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
@@ -593,7 +597,7 @@ CFontz633_get_contrast (Driver * drvthis)
* Value 0 to 1000. * Value 0 to 1000.
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_set_contrast (Driver * drvthis, int promille) CFontz633_set_contrast (Driver *drvthis, int promille)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
int hardware_contrast; int hardware_contrast;
@@ -609,7 +613,7 @@ CFontz633_set_contrast (Driver * drvthis, int promille)
hardware_contrast = (p->model == 633) hardware_contrast = (p->model == 633)
? ((p->contrast * 255) / 1000) ? ((p->contrast * 255) / 1000)
: (p->contrast / 20); : (p->contrast / 20);
/* Next line is to be checked $$$ */ /* Next line is to be checked $$$ */
send_onebyte_message(p->fd, CF633_Set_LCD_Contrast, hardware_contrast); send_onebyte_message(p->fd, CF633_Set_LCD_Contrast, hardware_contrast);
} }
@@ -620,11 +624,11 @@ CFontz633_set_contrast (Driver * drvthis, int promille)
* Need to find out if we have support for intermediate value. * Need to find out if we have support for intermediate value.
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_backlight (Driver * drvthis, int on) CFontz633_backlight (Driver *drvthis, int on)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
/* Next line is to be checked $$$ */ /* Next line is to be checked $$$ */
send_onebyte_message(p->fd, CF633_Set_LCD_And_Keypad_Backlight, send_onebyte_message(p->fd, CF633_Set_LCD_And_Keypad_Backlight,
(on) ? p->brightness : p->offbrightness); (on) ? p->brightness : p->offbrightness);
} }
@@ -649,11 +653,12 @@ static void
CFontz633_no_live_report (Driver *drvthis) CFontz633_no_live_report (Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
char out[2]= { 0, 0 }; char out[2] = { 0, 0 };
if (p->model == 633) if (p->model == 633) {
for (out[0] = 0; out[0] < 8; out[0]++) for (out[0] = 0; out[0] < 8; out[0]++)
send_bytes_message(p->fd, 2, CF633_Set_Up_Live_Fan_or_Temperature_Display , out); send_bytes_message(p->fd, 2, CF633_Set_Up_Live_Fan_or_Temperature_Display, out);
}
} }
@@ -677,7 +682,7 @@ static void
CFontz633_no_temp_report (Driver *drvthis) CFontz633_no_temp_report (Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
char out[4]= { 0, 0, 0, 0 }; char out[4] = { 0, 0, 0, 0 };
if (p->model == 633) if (p->model == 633)
send_bytes_message(p->fd, 4, CF633_Set_Up_Temperature_Reporting, out); send_bytes_message(p->fd, 4, CF633_Set_Up_Temperature_Reporting, out);
@@ -691,9 +696,10 @@ static void
CFontz633_reboot (Driver *drvthis) CFontz633_reboot (Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
char out[3]= { 8, 18, 99 }; char out[3] = { 8, 18, 99 };
send_bytes_message(p->fd, 3, CF633_Reboot, out); send_bytes_message(p->fd, 3, CF633_Reboot, out);
sleep(2);
} }
@@ -701,10 +707,9 @@ CFontz633_reboot (Driver *drvthis)
* Sets up for vertical bars. * Sets up for vertical bars.
*/ */
static void static void
CFontz633_init_vbar (Driver * drvthis) CFontz633_init_vbar (Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
char a[] = { 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,
@@ -799,10 +804,9 @@ CFontz633_init_vbar (Driver * drvthis)
* Inits horizontal bars... * Inits horizontal bars...
*/ */
static void static void
CFontz633_init_hbar (Driver * drvthis) CFontz633_init_hbar (Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
char a[] = { char a[] = {
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
@@ -867,7 +871,7 @@ CFontz633_init_hbar (Driver * drvthis)
if (p->ccmode != hbar) { if (p->ccmode != hbar) {
if (p->ccmode != standard) { if (p->ccmode != standard) {
/* Not supported(yet) */ /* Not supported(yet) */
report(RPT_WARNING, "CFontz633_init_vbar: Cannot combine two modes using user defined characters"); report(RPT_WARNING, "CFontz633_init_hbar: Cannot combine two modes using user defined characters");
return; return;
} }
p->ccmode = hbar; p->ccmode = hbar;
@@ -886,7 +890,7 @@ CFontz633_init_hbar (Driver * drvthis)
* Draws a vertical bar... * Draws a vertical bar...
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_vbar (Driver * drvthis, int x, int y, int len, int promille, int options) CFontz633_vbar (Driver *drvthis, int x, int y, int len, int promille, int options)
{ {
/* x and y are the start position of the bar. /* x and y are the start position of the bar.
* The bar by default grows in the 'up' direction * The bar by default grows in the 'up' direction
@@ -905,7 +909,7 @@ CFontz633_vbar (Driver * drvthis, int x, int y, int len, int promille, int optio
* Draws a horizontal bar to the right. * Draws a horizontal bar to the right.
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_hbar (Driver * drvthis, int x, int y, int len, int promille, int options) CFontz633_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
{ {
/* x and y are the start position of the bar. /* x and y are the start position of the bar.
* The bar by default grows in the 'right' direction * The bar by default grows in the 'right' direction
@@ -925,12 +929,12 @@ CFontz633_hbar (Driver * drvthis, int x, int y, int len, int promille, int optio
* This is not supported on 633 because we only have 2 lines... * This is not supported on 633 because we only have 2 lines...
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_num (Driver * drvthis, int x, int num) CFontz633_num (Driver *drvthis, int x, int num)
{ {
/* /*
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
char out[5]; char out[5];
snprintf (out, sizeof(out), "%c%c%c", 28, x, num); snprintf (out, sizeof(out), "%c%c%c", 28, x, num);
write (p->fd, out, 3); write (p->fd, out, 3);
*/ */
@@ -938,14 +942,14 @@ CFontz633_num (Driver * drvthis, int x, int num)
/* /*
* Sets a custom character from 0 - (NUM_CCs - 1) * Sets a custom character from 0 - (NUM_CCs-1)
* *
* For input, values > 0 mean "on" and values <= 0 are "off". * For input, values > 0 mean "on" and values <= 0 are "off".
* *
* The input is just an array of characters... * The input is just an array of characters...
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_set_char (Driver * drvthis, int n, char *dat) CFontz633_set_char (Driver *drvthis, int n, char *dat)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
char out[9]; char out[9];
@@ -975,7 +979,7 @@ CFontz633_set_char (Driver * drvthis, int n, char *dat)
* Places an icon on screen * Places an icon on screen
*/ */
MODULE_EXPORT int MODULE_EXPORT int
CFontz633_icon (Driver * drvthis, int x, int y, int icon) CFontz633_icon (Driver *drvthis, int x, int y, int icon)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
char icons[8][6 * 8] = { char icons[8][6 * 8] = {
@@ -1122,12 +1126,11 @@ CFontz633_icon (Driver * drvthis, int x, int y, int icon)
* Clears the LCD screen * Clears the LCD screen
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_clear (Driver * drvthis) CFontz633_clear (Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
memset(p->framebuf, ' ', p->width * p->height); memset(p->framebuf, ' ', p->width * p->height);
p->ccmode = standard; p->ccmode = standard;
} }
@@ -1136,7 +1139,7 @@ CFontz633_clear (Driver * drvthis)
* Hardware clears the LCD screen * Hardware clears the LCD screen
*/ */
static void static void
CFontz633_hardware_clear (Driver * drvthis) CFontz633_hardware_clear (Driver *drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
@@ -1149,7 +1152,7 @@ CFontz633_hardware_clear (Driver * drvthis)
* upper-left is (1,1), and the lower right should be (p->width, p->height). * upper-left is (1,1), and the lower right should be (p->width, p->height).
*/ */
MODULE_EXPORT void MODULE_EXPORT void
CFontz633_string (Driver * drvthis, int x, int y, char string[]) CFontz633_string (Driver *drvthis, int x, int y, char string[])
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
int i; int i;
@@ -1158,8 +1161,7 @@ CFontz633_string (Driver * drvthis, int x, int y, char string[])
x--; x--;
y--; y--;
for (i = 0; string[i] != '\0'; i++) for (i = 0; string[i] != '\0'; i++) {
{
/* Check for buffer overflows... */ /* Check for buffer overflows... */
if ((y * p->width) + x + i > (p->width * p->height)) if ((y * p->width) + x + i > (p->width * p->height))
break; break;