Converted old to new functions.
This commit is contained in:
+59
-51
@@ -372,9 +372,9 @@ curses_drv_init (Driver *drvthis, char *args)
|
|||||||
|
|
||||||
drvthis->backlight = curses_drv_backlight;
|
drvthis->backlight = curses_drv_backlight;
|
||||||
//drvthis->set_char = NULL;
|
//drvthis->set_char = NULL;
|
||||||
drvthis->old_icon = curses_drv_icon; // NEEDS TO BE CHANGED !
|
drvthis->icon = curses_drv_icon;
|
||||||
|
|
||||||
drvthis->getkey = curses_drv_getkey;
|
drvthis->get_key = curses_drv_get_key;
|
||||||
drvthis->heartbeat = curses_drv_heartbeat;
|
drvthis->heartbeat = curses_drv_heartbeat;
|
||||||
|
|
||||||
// Change the character used for "..."
|
// Change the character used for "..."
|
||||||
@@ -498,7 +498,7 @@ curses_drv_string (Driver *drvthis, int x, int y, char *string)
|
|||||||
// *p = icon_char;
|
// *p = icon_char;
|
||||||
// break;
|
// break;
|
||||||
case 255:
|
case 255:
|
||||||
*p = PAD;
|
*p = PAD; // CAN BE REMOVED AS SOON AS SERVER USES _icon INSTEAD OF character 255
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
@@ -521,10 +521,10 @@ curses_drv_chr (Driver *drvthis, int x, int y, char c)
|
|||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 0:
|
case 0:
|
||||||
c = icon_char;
|
c = icon_char; // The whole icon_char stuff can be removed too if API change is complete
|
||||||
break;
|
break;
|
||||||
case -1: // translates to 255 (ouch!)
|
case -1: // translates to 255 (ouch!)
|
||||||
c = PAD;
|
c = PAD; // CAN BE REMOVED AS SOON AS SERVER USES _icon INSTEAD OF character 255
|
||||||
break;
|
break;
|
||||||
//default:
|
//default:
|
||||||
// normal character...
|
// normal character...
|
||||||
@@ -570,16 +570,17 @@ curses_drv_vbar (Driver *drvthis, int x, int y, int len, int promille, int optio
|
|||||||
{
|
{
|
||||||
char map[] = { ACS_S9, ACS_S9, ACS_S7, ACS_S7, ACS_S3, ACS_S3, ACS_S1, ACS_S1 };
|
char map[] = { ACS_S9, ACS_S9, ACS_S7, ACS_S7, ACS_S3, ACS_S3, ACS_S1, ACS_S1 };
|
||||||
int pos;
|
int pos;
|
||||||
int total_pixels = (long) len * LCD_DEFAULT_CELLHEIGHT * promille / 1000;
|
int total_pixels = ((long) 2 * len * LCD_DEFAULT_CELLHEIGHT + 1 ) * promille / 2000;
|
||||||
|
|
||||||
ValidX(x);
|
ValidX(x);
|
||||||
ValidY(y);
|
ValidY(y);
|
||||||
|
|
||||||
// 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
|
||||||
// (other directions not yet implemented).
|
* (other direction not yet implemented).
|
||||||
// len is the number of characters that the bar is long at 100%
|
* len is the number of characters that the bar is long at 100%
|
||||||
// promille is the number of percent * 10 that the bar should be filled.
|
* promille is the number of promilles (0..1000) that the bar should be filled.
|
||||||
|
*/
|
||||||
|
|
||||||
for (pos = 0; pos < len; pos ++ ) {
|
for (pos = 0; pos < len; pos ++ ) {
|
||||||
|
|
||||||
@@ -588,8 +589,7 @@ curses_drv_vbar (Driver *drvthis, int x, int y, int len, int promille, int optio
|
|||||||
ValidY(y-pos);
|
ValidY(y-pos);
|
||||||
|
|
||||||
if( pixels >= LCD_DEFAULT_CELLHEIGHT ) {
|
if( pixels >= LCD_DEFAULT_CELLHEIGHT ) {
|
||||||
// write a "full" block to the screen...
|
/* write a "full" block to the screen... */
|
||||||
//curses_drv_chr (x, y, '8');
|
|
||||||
curses_drv_chr (drvthis, x, y-pos, ACS_BLOCK);
|
curses_drv_chr (drvthis, x, y-pos, ACS_BLOCK);
|
||||||
}
|
}
|
||||||
else if( pixels > 0 ) {
|
else if( pixels > 0 ) {
|
||||||
@@ -610,16 +610,17 @@ MODULE_EXPORT void
|
|||||||
curses_drv_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
curses_drv_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
int total_pixels = (long) len * LCD_DEFAULT_CELLWIDTH * promille / 1000;
|
int total_pixels = ((long) 2 * len * LCD_DEFAULT_CELLWIDTH + 1 ) * promille / 2000;
|
||||||
|
|
||||||
ValidX(x);
|
ValidX(x);
|
||||||
ValidY(y);
|
ValidY(y);
|
||||||
|
|
||||||
// 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 'right' direction
|
||||||
// (other directions not yet implemented).
|
* (other direction not yet implemented).
|
||||||
// len is the number of characters that the bar is long at 100%
|
* len is the number of characters that the bar is long at 100%
|
||||||
// promille is the number of percent * 10 that the bar should be filled.
|
* promille is the number of promilles (0..1000) that the bar should be filled.
|
||||||
|
*/
|
||||||
|
|
||||||
for (pos = 0; pos < len; pos ++ ) {
|
for (pos = 0; pos < len; pos ++ ) {
|
||||||
|
|
||||||
@@ -628,12 +629,11 @@ curses_drv_hbar (Driver *drvthis, int x, int y, int len, int promille, int optio
|
|||||||
ValidX(x+pos);
|
ValidX(x+pos);
|
||||||
|
|
||||||
if( pixels >= LCD_DEFAULT_CELLHEIGHT * 2/3 ) {
|
if( pixels >= LCD_DEFAULT_CELLHEIGHT * 2/3 ) {
|
||||||
// write a "full" block to the screen...
|
/* write a "full" block to the screen... */
|
||||||
//curses_drv_chr (x, y, '8');
|
|
||||||
curses_drv_chr (drvthis, x+pos, y, '=');
|
curses_drv_chr (drvthis, x+pos, y, '=');
|
||||||
}
|
}
|
||||||
else if( pixels > LCD_DEFAULT_CELLHEIGHT * 1/3 ) {
|
else if( pixels > LCD_DEFAULT_CELLHEIGHT * 1/3 ) {
|
||||||
// write a partial block...
|
/* write a partial block... */
|
||||||
curses_drv_chr (drvthis, x+pos, y, '-');
|
curses_drv_chr (drvthis, x+pos, y, '-');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -647,21 +647,22 @@ curses_drv_hbar (Driver *drvthis, int x, int y, int len, int promille, int optio
|
|||||||
// Sets character 0 to an icon...
|
// Sets character 0 to an icon...
|
||||||
//
|
//
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
curses_drv_icon (Driver *drvthis, int which, char dest)
|
curses_drv_icon (Driver *drvthis, int x, int y, int icon)
|
||||||
{
|
{
|
||||||
if (dest == 0)
|
switch (icon) {
|
||||||
switch (which) {
|
case ICON_HEART_OPEN:
|
||||||
case 0:
|
curses_drv_chr( drvthis, x, y, '+');
|
||||||
icon_char = '+';
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case ICON_HEART_FILLED:
|
||||||
icon_char = '*';
|
curses_drv_chr( drvthis, x, y, '*');
|
||||||
break;
|
break;
|
||||||
default:
|
case ICON_BLOCK_FILLED:
|
||||||
icon_char = PAD;
|
curses_drv_chr( drvthis, x, y, ACS_BLOCK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* There was something with placing PAD
|
||||||
|
* What wasthat ever for ?
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
@@ -679,17 +680,14 @@ curses_drv_heartbeat (Driver *drvthis, int type)
|
|||||||
|
|
||||||
if (type == HEARTBEAT_ON) {
|
if (type == HEARTBEAT_ON) {
|
||||||
// Set this to pulsate like a real heart beat...
|
// Set this to pulsate like a real heart beat...
|
||||||
whichIcon = (! ((timer + 4) & 5));
|
if ( (timer + 4) & 5 ) {
|
||||||
|
whichIcon = ICON_HEART_OPEN;
|
||||||
// This defines a custom character EVERY time...
|
}
|
||||||
// not efficient... is this necessary?
|
else {
|
||||||
curses_drv_icon (drvthis, whichIcon, 0);
|
whichIcon = ICON_HEART_FILLED;
|
||||||
|
}
|
||||||
// Put character on screen...
|
// Place the icon on screen
|
||||||
curses_drv_chr (drvthis, width, 1, 0);
|
curses_drv_icon (drvthis, width, 1, whichIcon);
|
||||||
|
|
||||||
// change display...
|
|
||||||
curses_drv_flush (drvthis);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
timer++;
|
timer++;
|
||||||
@@ -715,10 +713,11 @@ curses_drv_flush (Driver *drvthis)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MODULE_EXPORT char
|
MODULE_EXPORT char *
|
||||||
curses_drv_getkey (Driver *drvthis)
|
curses_drv_get_key (Driver *drvthis)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
static char ret_val[2] = {0,0};
|
||||||
|
|
||||||
i = getch ();
|
i = getch ();
|
||||||
|
|
||||||
@@ -728,22 +727,31 @@ curses_drv_getkey (Driver *drvthis)
|
|||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case KEY_LEFT:
|
case KEY_LEFT:
|
||||||
return 'D';
|
return "ArrowLeft";
|
||||||
break;
|
break;
|
||||||
case KEY_UP:
|
case KEY_UP:
|
||||||
return 'B';
|
return "ArrowUp";
|
||||||
break;
|
break;
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
return 'C';
|
return "ArrowDown";
|
||||||
break;
|
break;
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
return 'A';
|
return "ArrowRight";
|
||||||
break;
|
break;
|
||||||
case ERR:
|
case ERR:
|
||||||
return 0;
|
return NULL;
|
||||||
|
break;
|
||||||
|
case KEY_ENTER:
|
||||||
|
case 0x0D:
|
||||||
|
return "Enter"; /* Is this correct ? */
|
||||||
|
break;
|
||||||
|
case 0x1B:
|
||||||
|
return "Escape";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return i;
|
report( RPT_INFO, "curses_drv: Unknown key 0x%4x", i );
|
||||||
|
ret_val[0] = (char) i & 0xFF;
|
||||||
|
return ret_val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ MODULE_EXPORT void curses_drv_vbar (Driver *drvthis, int x, int y, int len, int
|
|||||||
MODULE_EXPORT void curses_drv_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
MODULE_EXPORT void curses_drv_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||||
MODULE_EXPORT void curses_drv_num (Driver *drvthis, int x, int num);
|
MODULE_EXPORT void curses_drv_num (Driver *drvthis, int x, int num);
|
||||||
MODULE_EXPORT void curses_drv_heartbeat (Driver *drvthis, int type);
|
MODULE_EXPORT void curses_drv_heartbeat (Driver *drvthis, int type);
|
||||||
MODULE_EXPORT void curses_drv_icon (Driver *drvthis, int which, char dest);
|
MODULE_EXPORT void curses_drv_icon (Driver *drvthis, int x, int y, int icon);
|
||||||
|
|
||||||
MODULE_EXPORT void curses_drv_backlight (Driver *drvthis, int on);
|
MODULE_EXPORT void curses_drv_backlight (Driver *drvthis, int on);
|
||||||
|
|
||||||
MODULE_EXPORT char curses_drv_getkey (Driver *drvthis);
|
MODULE_EXPORT char *curses_drv_get_key (Driver *drvthis);
|
||||||
|
|
||||||
MODULE_EXPORT void curses_drv_init_num (Driver *drvthis);
|
MODULE_EXPORT void curses_drv_init_num (Driver *drvthis);
|
||||||
|
|
||||||
|
|||||||
+28
-24
@@ -54,8 +54,8 @@ debug_init (Driver *drvthis, char *args)
|
|||||||
drvthis->clear = debug_clear;
|
drvthis->clear = debug_clear;
|
||||||
drvthis->string = debug_string;
|
drvthis->string = debug_string;
|
||||||
drvthis->chr = debug_chr;
|
drvthis->chr = debug_chr;
|
||||||
drvthis->old_vbar = debug_vbar;
|
drvthis->vbar = debug_vbar;
|
||||||
drvthis->old_hbar = debug_hbar;
|
drvthis->hbar = debug_hbar;
|
||||||
drvthis->init_num = debug_init_num;
|
drvthis->init_num = debug_init_num;
|
||||||
drvthis->num = debug_num;
|
drvthis->num = debug_num;
|
||||||
|
|
||||||
@@ -67,11 +67,11 @@ debug_init (Driver *drvthis, char *args)
|
|||||||
drvthis->set_contrast = debug_set_contrast;
|
drvthis->set_contrast = debug_set_contrast;
|
||||||
drvthis->backlight = debug_backlight;
|
drvthis->backlight = debug_backlight;
|
||||||
drvthis->set_char = debug_set_char;
|
drvthis->set_char = debug_set_char;
|
||||||
drvthis->old_icon = debug_icon;
|
drvthis->icon = debug_icon;
|
||||||
drvthis->init_vbar = debug_init_vbar;
|
drvthis->init_vbar = debug_init_vbar;
|
||||||
drvthis->init_hbar = debug_init_hbar;
|
drvthis->init_hbar = debug_init_hbar;
|
||||||
|
|
||||||
drvthis->getkey = debug_getkey;
|
drvthis->get_key = debug_get_key;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -229,51 +229,55 @@ debug_set_char (Driver *drvthis, int n, char *dat)
|
|||||||
// Draws a vertical bar; erases entire column onscreen.
|
// Draws a vertical bar; erases entire column onscreen.
|
||||||
//
|
//
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
debug_vbar (Driver *drvthis, int x, int len)
|
debug_vbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||||
{
|
{
|
||||||
int y;
|
int pos;
|
||||||
|
|
||||||
report (RPT_INFO, "vbar(%i,%i)", x, len);
|
report (RPT_INFO, "vbar(%i,%i,%i,%i,%i)", x, y, len, promille, options);
|
||||||
|
|
||||||
for (y = height; y > 0 && len > 0; y--) {
|
for ( pos=0; pos<len; pos++ ) {
|
||||||
debug_chr (drvthis, x, y, '|');
|
if( 2 * pos < ((long) promille * len / 500 + 1) ) {
|
||||||
|
debug_chr (drvthis, x, y-pos, '|');
|
||||||
len -= LCD_DEFAULT_CELLHEIGHT;
|
} else {
|
||||||
|
; /* print nothing */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Draws a horizontal bar to the right.
|
// Draws a horizontal bar to the right.
|
||||||
//
|
//
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
debug_hbar (Driver *drvthis, int x, int y, int len)
|
debug_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||||
{
|
{
|
||||||
report (RPT_INFO, "hbar(%i,%i,%i)", x, y, len);
|
int pos;
|
||||||
|
|
||||||
for (; x < width && len > 0; x++) {
|
report (RPT_INFO, "hbar(%i,%i,%i,%i,%i)", x, y, len, promille, options);
|
||||||
debug_chr (drvthis, x, y, '-');
|
|
||||||
|
|
||||||
len -= LCD_DEFAULT_CELLWIDTH;
|
for ( pos=0; pos<len; pos++ ) {
|
||||||
|
if( 2 * pos < ((long) promille * len / 500 + 1) ) {
|
||||||
|
debug_chr (drvthis, x+pos, y, '-');
|
||||||
|
} else {
|
||||||
|
; /* print nothing */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Sets character 0 to an icon...
|
// Sets character 0 to an icon...
|
||||||
//
|
//
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
debug_icon (Driver *drvthis, int which, char dest)
|
debug_icon (Driver *drvthis, int x, int y, int icon)
|
||||||
{
|
{
|
||||||
report (RPT_INFO, "icon(%i,%i", which, dest);
|
report (RPT_INFO, "icon(%i,%i,%i)", x, y, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Return a keypress
|
// Return a keypress
|
||||||
//
|
//
|
||||||
MODULE_EXPORT char
|
MODULE_EXPORT char *
|
||||||
debug_getkey (Driver *drvthis)
|
debug_get_key (Driver *drvthis)
|
||||||
{
|
{
|
||||||
report (RPT_INFO, "getkey()");
|
report (RPT_INFO, "get_key()");
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,17 +12,17 @@ MODULE_EXPORT void debug_flush (Driver *drvthis);
|
|||||||
MODULE_EXPORT void debug_string (Driver *drvthis, int x, int y, char string[]);
|
MODULE_EXPORT void debug_string (Driver *drvthis, int x, int y, char string[]);
|
||||||
MODULE_EXPORT void debug_chr (Driver *drvthis, int x, int y, char c);
|
MODULE_EXPORT void debug_chr (Driver *drvthis, int x, int y, char c);
|
||||||
|
|
||||||
MODULE_EXPORT void debug_vbar (Driver *drvthis, int x, int len);
|
MODULE_EXPORT void debug_vbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||||
MODULE_EXPORT void debug_hbar (Driver *drvthis, int x, int y, int len);
|
MODULE_EXPORT void debug_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||||
MODULE_EXPORT void debug_num (Driver *drvthis, int x, int num);
|
MODULE_EXPORT void debug_num (Driver *drvthis, int x, int num);
|
||||||
MODULE_EXPORT void debug_icon (Driver *drvthis, int which, char dest);
|
MODULE_EXPORT void debug_icon (Driver *drvthis, int x, int y, int icon);
|
||||||
|
|
||||||
MODULE_EXPORT void debug_set_char (Driver *drvthis, int n, char *dat);
|
MODULE_EXPORT void debug_set_char (Driver *drvthis, int n, char *dat);
|
||||||
|
|
||||||
MODULE_EXPORT void debug_set_contrast (Driver *drvthis, int promille);
|
MODULE_EXPORT void debug_set_contrast (Driver *drvthis, int promille);
|
||||||
MODULE_EXPORT void debug_backlight (Driver *drvthis, int promille);
|
MODULE_EXPORT void debug_backlight (Driver *drvthis, int promille);
|
||||||
|
|
||||||
MODULE_EXPORT char debug_getkey (Driver *drvthis);
|
MODULE_EXPORT char *debug_get_key (Driver *drvthis);
|
||||||
|
|
||||||
MODULE_EXPORT void debug_init_vbar (Driver *drvthis);
|
MODULE_EXPORT void debug_init_vbar (Driver *drvthis);
|
||||||
MODULE_EXPORT void debug_init_hbar (Driver *drvthis);
|
MODULE_EXPORT void debug_init_hbar (Driver *drvthis);
|
||||||
|
|||||||
+21
-33
@@ -118,9 +118,9 @@ text_init (Driver *drvthis, char *args)
|
|||||||
drvthis->string = text_string;
|
drvthis->string = text_string;
|
||||||
drvthis->chr = text_chr;
|
drvthis->chr = text_chr;
|
||||||
|
|
||||||
drvthis->old_vbar = text_vbar;
|
drvthis->vbar = text_vbar;
|
||||||
//drvthis->init_vbar = NULL;
|
//drvthis->init_vbar = NULL;
|
||||||
drvthis->old_hbar = text_hbar;
|
drvthis->hbar = text_hbar;
|
||||||
//drvthis->init_hbar = NULL;
|
//drvthis->init_hbar = NULL;
|
||||||
drvthis->num = text_num;
|
drvthis->num = text_num;
|
||||||
//drvthis->init_num = NULL;
|
//drvthis->init_num = NULL;
|
||||||
@@ -131,7 +131,7 @@ text_init (Driver *drvthis, char *args)
|
|||||||
//drvthis->set_char = NULL;
|
//drvthis->set_char = NULL;
|
||||||
//drvthis->icon = NULL;
|
//drvthis->icon = NULL;
|
||||||
|
|
||||||
//drvthis->getkey = NULL;
|
//drvthis->get_key = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -266,28 +266,11 @@ text_backlight (Driver *drvthis, int on)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//void
|
|
||||||
//text_init_vbar ()
|
|
||||||
//{
|
|
||||||
//// printf("Vertical bars.\n");
|
|
||||||
//}
|
|
||||||
|
|
||||||
//void
|
|
||||||
//text_init_hbar ()
|
|
||||||
//{
|
|
||||||
//// printf("Horizontal bars.\n");
|
|
||||||
//}
|
|
||||||
|
|
||||||
//void
|
|
||||||
//text_init_num ()
|
|
||||||
//{
|
|
||||||
//// printf("Big Numbers.\n");
|
|
||||||
//}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Writes a big number. (by Rene Wagner from lcdm001.c)
|
// Writes a big number. (by Rene Wagner from lcdm001.c)
|
||||||
//
|
//
|
||||||
MODULE_EXPORT void text_num (Driver *drvthis, int x, int num)
|
MODULE_EXPORT void
|
||||||
|
text_num (Driver *drvthis, int x, int num)
|
||||||
{
|
{
|
||||||
//PrivateData * p = (PrivateData*) drvthis->private_data;
|
//PrivateData * p = (PrivateData*) drvthis->private_data;
|
||||||
|
|
||||||
@@ -309,28 +292,33 @@ MODULE_EXPORT void text_num (Driver *drvthis, int x, int num)
|
|||||||
// Draws a vertical bar; erases entire column onscreen.
|
// Draws a vertical bar; erases entire column onscreen.
|
||||||
//
|
//
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
text_vbar (Driver *drvthis, int x, int len)
|
text_vbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||||
{
|
{
|
||||||
int y;
|
int pos;
|
||||||
for (y = height; y > 0 && len > 0; y--) {
|
|
||||||
text_chr (drvthis, x, y, '|');
|
|
||||||
|
|
||||||
len -= LCD_DEFAULT_CELLHEIGHT;
|
for ( pos=0; pos<len; pos++ ) {
|
||||||
|
if( 2 * pos < ((long) promille * len / 500 + 1) ) {
|
||||||
|
text_chr (drvthis, x, y-pos, '|');
|
||||||
|
} else {
|
||||||
|
; /* print nothing */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Draws a horizontal bar to the right.
|
// Draws a horizontal bar to the right.
|
||||||
//
|
//
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
text_hbar (Driver *drvthis, int x, int y, int len)
|
text_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||||
{
|
{
|
||||||
for (; x <= width && len > 0; x++) {
|
int pos;
|
||||||
text_chr (drvthis, x, y, '-');
|
|
||||||
|
|
||||||
len -= LCD_DEFAULT_CELLWIDTH;
|
for ( pos=0; pos<len; pos++ ) {
|
||||||
|
if( 2 * pos < ((long) promille * len / 500 + 1) ) {
|
||||||
|
text_chr (drvthis, x+pos, y, '-');
|
||||||
|
} else {
|
||||||
|
; /* print nothing */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ MODULE_EXPORT void text_backlight (Driver *drvthis, int on);
|
|||||||
//MODULE_EXPORT void text_init_vbar (Driver *drvthis);
|
//MODULE_EXPORT void text_init_vbar (Driver *drvthis);
|
||||||
//MODULE_EXPORT void text_init_hbar (Driver *drvthis);
|
//MODULE_EXPORT void text_init_hbar (Driver *drvthis);
|
||||||
//MODULE_EXPORT void text_init_num (Driver *drvthis);
|
//MODULE_EXPORT void text_init_num (Driver *drvthis);
|
||||||
MODULE_EXPORT void text_vbar (Driver *drvthis, int x, int len);
|
MODULE_EXPORT void text_vbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||||
MODULE_EXPORT void text_hbar (Driver *drvthis, int x, int y, int len);
|
MODULE_EXPORT void text_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||||
MODULE_EXPORT void text_num (Driver *drvthis, int x, int num);
|
MODULE_EXPORT void text_num (Driver *drvthis, int x, int num);
|
||||||
//MODULE_EXPORT void text_set_char (Driver *drvthis, int n, char *dat);
|
//MODULE_EXPORT void text_set_char (Driver *drvthis, int n, char *dat);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user