Unallocated framebuffer fix.
This commit is contained in:
@@ -175,6 +175,12 @@ CFontz_init (lcd_logical_driver * driver, char *args)
|
|||||||
// Do it...
|
// Do it...
|
||||||
tcsetattr (fd, TCSANOW, &portset);
|
tcsetattr (fd, TCSANOW, &portset);
|
||||||
|
|
||||||
|
// Make sure the frame buffer is there...
|
||||||
|
if (!CFontz->framebuf)
|
||||||
|
CFontz->framebuf = (unsigned char *)
|
||||||
|
malloc (CFontz->wid * CFontz->hgt);
|
||||||
|
memset (CFontz->framebuf, ' ', CFontz->wid * CFontz->hgt);
|
||||||
|
|
||||||
// Set display-specific stuff..
|
// Set display-specific stuff..
|
||||||
if (reboot) {
|
if (reboot) {
|
||||||
CFontz_reboot ();
|
CFontz_reboot ();
|
||||||
|
|||||||
+27
-28
@@ -98,10 +98,10 @@ static void MtxOrb_autoscroll (int on);
|
|||||||
static void MtxOrb_cursorblink (int on);
|
static void MtxOrb_cursorblink (int on);
|
||||||
static void MtxOrb_string (int x, int y, char *string);
|
static void MtxOrb_string (int x, int y, char *string);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This does not belong to MtxOrb.h except if used externaly
|
* This does not belong to MtxOrb.h except if used externaly
|
||||||
* Having them here reduce the number of warning.
|
* Having them here reduce the number of warning.
|
||||||
*/
|
*/
|
||||||
static void MtxOrb_clear ();
|
static void MtxOrb_clear ();
|
||||||
static void MtxOrb_close ();
|
static void MtxOrb_close ();
|
||||||
static void MtxOrb_flush ();
|
static void MtxOrb_flush ();
|
||||||
@@ -387,12 +387,11 @@ MtxOrb_init (lcd_logical_driver * driver, char *args)
|
|||||||
malloc (MtxOrb->wid * MtxOrb->hgt);
|
malloc (MtxOrb->wid * MtxOrb->hgt);
|
||||||
memset (MtxOrb->framebuf, ' ', MtxOrb->wid * MtxOrb->hgt);
|
memset (MtxOrb->framebuf, ' ', MtxOrb->wid * MtxOrb->hgt);
|
||||||
|
|
||||||
|
|
||||||
// Allocate and clear the buffer for incremental updates
|
// Allocate and clear the buffer for incremental updates
|
||||||
lcd_contents = (unsigned char *) malloc (MtxOrb->wid * MtxOrb->hgt);
|
lcd_contents = (unsigned char *) malloc (MtxOrb->wid * MtxOrb->hgt);
|
||||||
if (!lcd_contents) { return -1; }
|
if (!lcd_contents) { return -1; }
|
||||||
memset(lcd_contents, ' ', MtxOrb->wid * MtxOrb->hgt);
|
memset(lcd_contents, ' ', MtxOrb->wid * MtxOrb->hgt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configure display
|
* Configure display
|
||||||
*/
|
*/
|
||||||
@@ -613,12 +612,12 @@ MtxOrb_backlight (int on)
|
|||||||
backlight_state = on;
|
backlight_state = on;
|
||||||
|
|
||||||
switch (on) {
|
switch (on) {
|
||||||
case BACKLIGHT_ON:
|
case BACKLIGHT_ON:
|
||||||
write (fd, "\x0FE" "F", 2);
|
write (fd, "\x0FE" "F", 2);
|
||||||
if (debug_level > 3)
|
if (debug_level > 3)
|
||||||
syslog(LOG_DEBUG, "MtxOrb: backlight turned on");
|
syslog(LOG_DEBUG, "MtxOrb: backlight turned on");
|
||||||
break;
|
break;
|
||||||
case BACKLIGHT_OFF:
|
case BACKLIGHT_OFF:
|
||||||
if (IS_VKD_DISPLAY || IS_VFD_DISPLAY) {
|
if (IS_VKD_DISPLAY || IS_VFD_DISPLAY) {
|
||||||
if (debug_level > 3)
|
if (debug_level > 3)
|
||||||
syslog(LOG_DEBUG, "MtxOrb: backlight ignored - not LCD or LKD display");
|
syslog(LOG_DEBUG, "MtxOrb: backlight ignored - not LCD or LKD display");
|
||||||
@@ -1348,7 +1347,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
{
|
{
|
||||||
char all_bar[25][5 * 8] = {
|
char all_bar[25][5 * 8] = {
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, // char u1[] =
|
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,
|
||||||
@@ -1357,7 +1356,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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 u2[] =
|
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,
|
0, 0, 0, 0, 0,
|
||||||
@@ -1366,7 +1365,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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 u3[] =
|
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,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
@@ -1375,7 +1374,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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 u4[] =
|
0, 0, 0, 0, 0, // char u4[] =
|
||||||
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,
|
||||||
@@ -1384,7 +1383,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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, // char u5[] =
|
||||||
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,
|
||||||
@@ -1393,7 +1392,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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, // char u6[] =
|
||||||
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,
|
||||||
@@ -1402,7 +1401,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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[] =
|
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,
|
||||||
@@ -1411,7 +1410,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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 d1[] =
|
1, 1, 1, 1, 1, // char d1[] =
|
||||||
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,
|
||||||
@@ -1420,7 +1419,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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 d2[] =
|
1, 1, 1, 1, 1, // char d2[] =
|
||||||
1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
@@ -1429,7 +1428,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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 d3[] =
|
1, 1, 1, 1, 1, // char d3[] =
|
||||||
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,
|
0, 0, 0, 0, 0,
|
||||||
@@ -1438,7 +1437,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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 d4[] =
|
1, 1, 1, 1, 1, // char d4[] =
|
||||||
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,
|
||||||
@@ -1447,7 +1446,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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 d5[] =
|
1, 1, 1, 1, 1, // char d5[] =
|
||||||
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,
|
||||||
@@ -1456,7 +1455,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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 d6[] =
|
1, 1, 1, 1, 1, // char d6[] =
|
||||||
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,
|
||||||
@@ -1465,7 +1464,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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 d7[] =
|
1, 1, 1, 1, 1, // char d7[] =
|
||||||
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,
|
||||||
@@ -1474,7 +1473,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
}, {
|
}, {
|
||||||
1, 0, 0, 0, 0, // char r1[] =
|
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,
|
||||||
@@ -1483,7 +1482,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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, // 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,
|
||||||
@@ -1492,7 +1491,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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, // 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,
|
||||||
@@ -1501,7 +1500,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
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, // 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,
|
||||||
@@ -1510,7 +1509,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
1, 1, 1, 1, 0,
|
1, 1, 1, 1, 0,
|
||||||
1, 1, 1, 1, 0,
|
1, 1, 1, 1, 0,
|
||||||
}, {
|
}, {
|
||||||
0, 0, 0, 0, 1, // char l1[] =
|
0, 0, 0, 0, 1, // char l1[] =
|
||||||
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,
|
||||||
@@ -1519,7 +1518,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
0, 0, 0, 0, 1,
|
0, 0, 0, 0, 1,
|
||||||
0, 0, 0, 0, 1,
|
0, 0, 0, 0, 1,
|
||||||
}, {
|
}, {
|
||||||
0, 0, 0, 1, 1, // char l2[] =
|
0, 0, 0, 1, 1, // char l2[] =
|
||||||
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,
|
||||||
@@ -1528,7 +1527,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
0, 0, 0, 1, 1,
|
0, 0, 0, 1, 1,
|
||||||
0, 0, 0, 1, 1,
|
0, 0, 0, 1, 1,
|
||||||
}, {
|
}, {
|
||||||
0, 0, 1, 1, 1, // char l3[] =
|
0, 0, 1, 1, 1, // char l3[] =
|
||||||
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,
|
||||||
@@ -1537,7 +1536,7 @@ MtxOrb_set_known_char (int car, int type)
|
|||||||
0, 0, 1, 1, 1,
|
0, 0, 1, 1, 1,
|
||||||
0, 0, 1, 1, 1,
|
0, 0, 1, 1, 1,
|
||||||
}, {
|
}, {
|
||||||
0, 1, 1, 1, 1, // char l4[] =
|
0, 1, 1, 1, 1, // char l4[] =
|
||||||
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,
|
||||||
|
|||||||
+40
-28
@@ -68,14 +68,14 @@ int LB216_init(lcd_logical_driver *driver, char *args)
|
|||||||
int i;
|
int i;
|
||||||
int tmp;
|
int tmp;
|
||||||
int reboot=0;
|
int reboot=0;
|
||||||
|
|
||||||
char device[256] = "/dev/lcd";
|
char device[256] = "/dev/lcd";
|
||||||
int speed=B9600;
|
int speed=B9600;
|
||||||
|
|
||||||
LB216 = driver;
|
LB216 = driver;
|
||||||
|
|
||||||
//debug("LB216_init: Args(all): %s\n", args);
|
//debug("LB216_init: Args(all): %s\n", args);
|
||||||
|
|
||||||
argc = get_args(argv, args, 64);
|
argc = get_args(argv, args, 64);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -84,7 +84,7 @@ int LB216_init(lcd_logical_driver *driver, char *args)
|
|||||||
printf("Arg(%i): %s\n", i, argv[i]);
|
printf("Arg(%i): %s\n", i, argv[i]);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for(i=0; i<argc; i++)
|
for(i=0; i<argc; i++)
|
||||||
{
|
{
|
||||||
//printf("Arg(%i): %s\n", i, argv[i]);
|
//printf("Arg(%i): %s\n", i, argv[i]);
|
||||||
@@ -150,12 +150,12 @@ int LB216_init(lcd_logical_driver *driver, char *args)
|
|||||||
{
|
{
|
||||||
printf("Invalid parameter: %s\n", argv[i]);
|
printf("Invalid parameter: %s\n", argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up io port correctly, and open it...
|
// Set up io port correctly, and open it...
|
||||||
fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY);
|
fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "LB216_init: failed (%s)\n", strerror(errno));
|
fprintf(stderr, "LB216_init: failed (%s)\n", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
@@ -183,7 +183,13 @@ int LB216_init(lcd_logical_driver *driver, char *args)
|
|||||||
|
|
||||||
// Do it...
|
// Do it...
|
||||||
tcsetattr(fd, TCSANOW, &portset);
|
tcsetattr(fd, TCSANOW, &portset);
|
||||||
|
|
||||||
|
|
||||||
|
// Make sure the frame buffer is there...
|
||||||
|
if (!LB216->framebuf)
|
||||||
|
LB216->framebuf = (unsigned char *)
|
||||||
|
malloc (LB216->wid * LB216->hgt);
|
||||||
|
memset (LB216->framebuf, ' ', LB216->wid * LB216->hgt);
|
||||||
|
|
||||||
// Set display-specific stuff..
|
// Set display-specific stuff..
|
||||||
if(reboot)
|
if(reboot)
|
||||||
@@ -222,7 +228,7 @@ int LB216_init(lcd_logical_driver *driver, char *args)
|
|||||||
LB216->cellhgt = 8;
|
LB216->cellhgt = 8;
|
||||||
|
|
||||||
debug("LB216: foo!\n");
|
debug("LB216: foo!\n");
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,9 +237,9 @@ int LB216_init(lcd_logical_driver *driver, char *args)
|
|||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Clean-up
|
// Clean-up
|
||||||
//
|
//
|
||||||
void LB216_close()
|
void LB216_close()
|
||||||
{
|
{
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
if(LB216->framebuf) free(LB216->framebuf);
|
if(LB216->framebuf) free(LB216->framebuf);
|
||||||
|
|
||||||
@@ -261,15 +267,21 @@ void LB216_flush()
|
|||||||
// Prints a character on the lcd display, at position (x,y). The
|
// Prints a character on the lcd display, at position (x,y). The
|
||||||
// upper-left is (1,1), and the lower right should be (16,2).
|
// upper-left is (1,1), and the lower right should be (16,2).
|
||||||
//
|
//
|
||||||
void LB216_chr(int x, int y, char c)
|
void LB216_chr(int x, int y, char c)
|
||||||
{
|
{
|
||||||
//y--;
|
//y--;
|
||||||
// x--;
|
// x--;
|
||||||
|
|
||||||
//if(c < 32 && c >= 0) c += 128;
|
//if(c < 32 && c >= 0) c += 128;
|
||||||
// LB216->framebuf[(y*LB216->wid) + x] = c;
|
// LB216->framebuf[(y*LB216->wid) + x] = c;
|
||||||
char chr[1];
|
|
||||||
snprintf (chr, sizeof(chr), "%c", c);
|
// char chr[1];
|
||||||
|
// snprintf (chr, sizeof(chr), "%c", c);
|
||||||
|
// Above two lines are incorrect (Joris)
|
||||||
|
|
||||||
|
char chr[2];
|
||||||
|
chr[0] = c;
|
||||||
|
chr[1] = 0;
|
||||||
LB216_string (x, y, chr);
|
LB216_string (x, y, chr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +335,7 @@ void LB216_draw_frame(char *dat)
|
|||||||
{
|
{
|
||||||
char out[LCD_MAX_WIDTH * LCD_MAX_HEIGHT];
|
char out[LCD_MAX_WIDTH * LCD_MAX_HEIGHT];
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
if(!dat) return;
|
if(!dat) return;
|
||||||
|
|
||||||
snprintf (out, sizeof(out), "%c%c", 254,80);
|
snprintf (out, sizeof(out), "%c%c", 254,80);
|
||||||
@@ -365,7 +377,7 @@ void LB216_string (int x, int y, char string[])
|
|||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Sets up for vertical bars. Call before LB216->vbar()
|
// Sets up for vertical bars. Call before LB216->vbar()
|
||||||
//
|
//
|
||||||
void LB216_init_vbar()
|
void LB216_init_vbar()
|
||||||
{
|
{
|
||||||
char a[] = {
|
char a[] = {
|
||||||
0,0,0,0,0,
|
0,0,0,0,0,
|
||||||
@@ -453,7 +465,7 @@ void LB216_init_vbar()
|
|||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Inits horizontal bars...
|
// Inits horizontal bars...
|
||||||
//
|
//
|
||||||
void LB216_init_hbar()
|
void LB216_init_hbar()
|
||||||
{
|
{
|
||||||
|
|
||||||
char a[] = {
|
char a[] = {
|
||||||
@@ -520,10 +532,10 @@ void LB216_init_hbar()
|
|||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Draws a vertical bar...
|
// Draws a vertical bar...
|
||||||
//
|
//
|
||||||
void LB216_vbar(int x, int len)
|
void LB216_vbar(int x, int len)
|
||||||
{
|
{
|
||||||
char map[9] = {32, 1, 2, 3, 4, 5, 6, 7, 255 };
|
char map[9] = {32, 1, 2, 3, 4, 5, 6, 7, 255 };
|
||||||
|
|
||||||
|
|
||||||
int y;
|
int y;
|
||||||
for(y=LB216->hgt; y > 0 && len>0; y--)
|
for(y=LB216->hgt; y > 0 && len>0; y--)
|
||||||
@@ -533,7 +545,7 @@ void LB216_vbar(int x, int len)
|
|||||||
|
|
||||||
len -= LB216->cellhgt;
|
len -= LB216->cellhgt;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -547,10 +559,10 @@ void LB216_hbar(int x, int y, int len)
|
|||||||
{
|
{
|
||||||
if(len >= LB216->cellwid) LB216_chr(x,y,map[5]);
|
if(len >= LB216->cellwid) LB216_chr(x,y,map[5]);
|
||||||
else LB216_chr(x, y, map[len]);
|
else LB216_chr(x, y, map[len]);
|
||||||
|
|
||||||
//printf ("%d,",len);
|
//printf ("%d,",len);
|
||||||
len -= LB216->cellwid;
|
len -= LB216->cellwid;
|
||||||
|
|
||||||
}
|
}
|
||||||
// printf ("\n");
|
// printf ("\n");
|
||||||
|
|
||||||
@@ -602,7 +614,7 @@ void LB216_icon(int which, char dest)
|
|||||||
1,0,0,0,1,
|
1,0,0,0,1,
|
||||||
1,1,0,1,1,
|
1,1,0,1,1,
|
||||||
1,1,1,1,1,
|
1,1,1,1,1,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
1,1,1,1,1, // Filled Heart
|
1,1,1,1,1, // Filled Heart
|
||||||
@@ -614,7 +626,7 @@ void LB216_icon(int which, char dest)
|
|||||||
1,1,0,1,1,
|
1,1,0,1,1,
|
||||||
1,1,1,1,1,
|
1,1,1,1,1,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
0,0,0,0,0, // Ellipsis
|
0,0,0,0,0, // Ellipsis
|
||||||
0,0,0,0,0,
|
0,0,0,0,0,
|
||||||
@@ -625,9 +637,9 @@ void LB216_icon(int which, char dest)
|
|||||||
0,0,0,0,0,
|
0,0,0,0,0,
|
||||||
1,0,1,0,1,
|
1,0,1,0,1,
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if(custom==bign) custom=beat;
|
if(custom==bign) custom=beat;
|
||||||
LB216_set_char(dest, &icons[which][0]);
|
LB216_set_char(dest, &icons[which][0]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,15 @@ text_init (lcd_logical_driver * driver, char *args)
|
|||||||
{
|
{
|
||||||
text = driver;
|
text = driver;
|
||||||
|
|
||||||
|
// Make sure the frame buffer is there...
|
||||||
|
if (!text->framebuf)
|
||||||
|
text->framebuf = (unsigned char *)
|
||||||
|
malloc (text->wid * text->hgt);
|
||||||
|
memset (text->framebuf, ' ', text->wid * text->hgt);
|
||||||
|
|
||||||
|
|
||||||
|
// Set the functions the driver supports
|
||||||
|
|
||||||
text->wid = LCD_DEFAULT_WIDTH;
|
text->wid = LCD_DEFAULT_WIDTH;
|
||||||
text->hgt = LCD_DEFAULT_HEIGHT;
|
text->hgt = LCD_DEFAULT_HEIGHT;
|
||||||
text->cellwid = LCD_DEFAULT_CELL_WIDTH;
|
text->cellwid = LCD_DEFAULT_CELL_WIDTH;
|
||||||
|
|||||||
Reference in New Issue
Block a user