update bar functions to 0.5 API for Wirz SLI and MTC_S16209X drivers
This commit is contained in:
@@ -1100,6 +1100,8 @@ MtxOrb_vbar (Driver * drvthis, int x, int y, int len, int promille, int options)
|
||||
*/
|
||||
|
||||
MtxOrb_mold_vbar (drvthis, x, y, total_pixels);
|
||||
// this is what's in the library for it:
|
||||
// lib_vbar_static(drvthis, x, y, len, promille, options, p->cellheight, 0);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
@@ -1128,6 +1130,8 @@ MtxOrb_hbar (Driver * drvthis, int x, int y, int len, int promille, int options)
|
||||
*/
|
||||
|
||||
MtxOrb_old_hbar (drvthis, x, y, total_pixels);
|
||||
// this is what's in the library for it:
|
||||
// lib_hbar_static(drvthis, x, y, len, promille, options, p->cellwidth, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
#endif
|
||||
|
||||
#include "lcd.h"
|
||||
#include "lcd_lib.h"
|
||||
#include "mtc_s16209x.h"
|
||||
//#include "shared/str.h"
|
||||
#include "report.h"
|
||||
|
||||
#define MTC_DEFAULT_DEVICE "/dev/lcd"
|
||||
@@ -103,7 +103,9 @@ static int cellwidth = LCD_DEFAULT_CELLWIDTH;
|
||||
static int cellheight = LCD_DEFAULT_CELLHEIGHT;
|
||||
|
||||
//static void MTC_S16209X_hidecursor ();
|
||||
#ifdef CAN_REBOOT_LCD
|
||||
static void MTC_S16209X_reboot ();
|
||||
#endif // CAN_REBOOT_LCD
|
||||
|
||||
// Vars for the server core
|
||||
MODULE_EXPORT char *api_version = API_VERSION;
|
||||
@@ -187,6 +189,11 @@ MTC_S16209X_init (Driver * drvthis)
|
||||
report(RPT_WARNING, "MTC_S16209X_init(): write(lcd_open) failed (%s)\n",
|
||||
strerror(errno));
|
||||
|
||||
#ifdef CAN_REBOOT_LCD
|
||||
if (reboot)
|
||||
MTC_S16209X_reboot();
|
||||
#endif // CAN_REBOOT_LCD
|
||||
|
||||
my_error_handle = write (fd, lcd_clearscreen, sizeof (lcd_clearscreen)); // Clear the LCD, unbuffered
|
||||
|
||||
if (my_error_handle < 0)
|
||||
@@ -330,6 +337,7 @@ MTC_S16209X_hidecursor ()
|
||||
}
|
||||
#endif // THIS_PART_SHOULD_BE_REMOVED
|
||||
|
||||
#ifdef CAN_REBOOT_LCD
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Reset the display bios
|
||||
//
|
||||
@@ -342,6 +350,7 @@ MTC_S16209X_reboot ()
|
||||
flock (fd, LOCK_UN);
|
||||
|
||||
}
|
||||
#endif // CAN_REBOOT_LCD
|
||||
|
||||
MODULE_EXPORT void
|
||||
MTC_S16209X_string (Driver * drvthis, int x, int y, char string[])
|
||||
@@ -360,7 +369,7 @@ MTC_S16209X_string (Driver * drvthis, int x, int y, char string[])
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Sets up for vertical bars. Call before MTC_S16209X->vbar()
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
static void
|
||||
MTC_S16209X_init_vbar (Driver * drvthis)
|
||||
{
|
||||
char a[] = {
|
||||
@@ -456,7 +465,7 @@ MTC_S16209X_init_vbar (Driver * drvthis)
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Inits horizontal bars...
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
static void
|
||||
MTC_S16209X_init_hbar (Driver * drvthis)
|
||||
{
|
||||
|
||||
@@ -526,45 +535,22 @@ MTC_S16209X_init_hbar (Driver * drvthis)
|
||||
// Draws a vertical bar...
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
MTC_S16209X_vbar (Driver * drvthis, int x, int len)
|
||||
MTC_S16209X_vbar (Driver * drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
char map[9] = { 32, 1, 2, 3, 4, 5, 6, 7, 255 };
|
||||
|
||||
|
||||
int y;
|
||||
for (y = height; y > 0 && len > 0; y--)
|
||||
{
|
||||
if (len >= cellheight)
|
||||
MTC_S16209X_chr (drvthis, x, y, 0xFF);
|
||||
else
|
||||
MTC_S16209X_chr (drvthis, x, y, map[len]);
|
||||
|
||||
len -= cellheight;
|
||||
}
|
||||
MTC_S16209X_init_vbar(drvthis);
|
||||
|
||||
lib_vbar_static(drvthis, x, y, len, promille, options, cellheight, 0);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Draws a horizontal bar to the right.
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
MTC_S16209X_hbar (Driver * drvthis, int x, int y, int len)
|
||||
MTC_S16209X_hbar (Driver * drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
char map[7] = { 32, 1, 2, 3, 4, 5 };
|
||||
|
||||
for (; x <= width && len > 0; x++)
|
||||
{
|
||||
if (len >= cellwidth)
|
||||
MTC_S16209X_chr (drvthis, x, y, map[5]);
|
||||
else
|
||||
MTC_S16209X_chr (drvthis, x, y, map[len]);
|
||||
|
||||
//printf ("%d,",len);
|
||||
len -= cellwidth;
|
||||
|
||||
}
|
||||
// printf ("\n");
|
||||
MTC_S16209X_init_hbar(drvthis);
|
||||
|
||||
lib_hbar_static(drvthis, x, y, len, promille, options, cellwidth, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,20 +48,14 @@ MODULE_EXPORT void MTC_S16209X_clear (Driver * drvthis);
|
||||
MODULE_EXPORT void MTC_S16209X_flush(Driver * drvthis);
|
||||
MODULE_EXPORT void MTC_S16209X_string (Driver * drvthis, int x, int y, char string[]);
|
||||
MODULE_EXPORT void MTC_S16209X_chr(Driver * drvthis, int x, int y, char c) ;
|
||||
int MTC_S16209X_gotoxy(int x, int y);
|
||||
|
||||
MODULE_EXPORT void MTC_S16209X_old_vbar(Driver * drvthis, int x, int len);
|
||||
MODULE_EXPORT void MTC_S16209X_old_hbar(Driver * drvthis, int x, int y, int len);
|
||||
MODULE_EXPORT void MTC_S16209X_num(Driver * drvthis, int x, int num);
|
||||
MODULE_EXPORT void MTC_S16209X_vbar(Driver * drvthis, int x, int y, int len, int promille, int options);
|
||||
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_backlight(Driver * drvthis, int on);
|
||||
|
||||
MODULE_EXPORT void MTC_S16209X_init_vbar(Driver * drvthis);
|
||||
MODULE_EXPORT void MTC_S16209X_init_hbar(Driver * drvthis);
|
||||
MODULE_EXPORT void MTC_S16209X_init_num(Driver * drvthis);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+11
-26
@@ -38,6 +38,8 @@ static int fd;
|
||||
static char *framebuf = NULL;
|
||||
static int width = 0;
|
||||
static int height = 0;
|
||||
static int cellwidth = LCD_DEFAULT_CELLWIDTH;
|
||||
static int cellheight = LCD_DEFAULT_CELLHEIGHT;
|
||||
|
||||
// Vars for the server core
|
||||
MODULE_EXPORT char *api_version = API_VERSION;
|
||||
@@ -419,40 +421,22 @@ sli_init_hbar (Driver *drvthis)
|
||||
for me to add */
|
||||
|
||||
MODULE_EXPORT void
|
||||
sli_old_vbar (Driver *drvthis, int x, int len)
|
||||
sli_vbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
char map[9] = { 32, 1, 2, 3, 4, 5, 6, 7, 255 };
|
||||
|
||||
int y;
|
||||
for (y = height; y > 0 && len > 0; y--) {
|
||||
if (len >= LCD_DEFAULT_CELLHEIGHT)
|
||||
sli_chr (drvthis, x, y, 255);
|
||||
else
|
||||
sli_chr (drvthis, x, y, map[len]);
|
||||
|
||||
len -= LCD_DEFAULT_CELLHEIGHT;
|
||||
}
|
||||
sli_init_vbar(drvthis);
|
||||
|
||||
lib_vbar_static(drvthis, x, y, len, promille, options, cellheight, 0);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Draws a horizontal bar to the right.
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
sli_old_hbar (Driver *drvthis, int x, int y, int len)
|
||||
sli_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
char map[6] = { 32, 1, 2, 3, 4, 255 };
|
||||
|
||||
for (; x <= width && len > 0; x++) {
|
||||
if (len >= LCD_DEFAULT_CELLWIDTH)
|
||||
sli_chr (drvthis, x, y, 255);
|
||||
else
|
||||
sli_chr (drvthis, x, y, map[len]);
|
||||
|
||||
len -= LCD_DEFAULT_CELLWIDTH;
|
||||
|
||||
}
|
||||
sli_init_hbar(drvthis);
|
||||
|
||||
lib_hbar_static(drvthis, x, y, len, promille, options, cellwidth, 0);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
@@ -496,8 +480,8 @@ sli_set_char (Driver *drvthis, int n, char *dat)
|
||||
write (fd, out, 2);
|
||||
}
|
||||
|
||||
MODULE_EXPORT void
|
||||
sli_old_icon (Driver *drvthis, int x, int y, int icon)
|
||||
MODULE_EXPORT int
|
||||
sli_icon (Driver *drvthis, int x, int y, int icon)
|
||||
{
|
||||
char icons[3][5 * 8] = {
|
||||
{
|
||||
@@ -552,5 +536,6 @@ sli_old_icon (Driver *drvthis, int x, int y, int icon)
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,9 @@ MODULE_EXPORT void sli_flush (Driver *drvthis);
|
||||
MODULE_EXPORT void sli_string (Driver *drvthis, int x, int y, char *string);
|
||||
MODULE_EXPORT void sli_chr (Driver *drvthis, int x, int y, char c);
|
||||
|
||||
MODULE_EXPORT void sli_old_vbar (Driver *drvthis, int x, int len);
|
||||
MODULE_EXPORT void sli_old_hbar (Driver *drvthis, int x, int y, int len);
|
||||
MODULE_EXPORT void sli_num (Driver *drvthis, int x, int num);
|
||||
MODULE_EXPORT void sli_old_icon (Driver *drvthis, int which, char dest);
|
||||
MODULE_EXPORT void sli_vbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user