Some formatting changes: Use tabs to indent, C-style comments and remove
some outdated comments as well as trailing whitespace.
This commit is contained in:
+20
-36
@@ -10,7 +10,7 @@
|
||||
* \note The GLK series of graphical displays is supported by the \c glk driver.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*-
|
||||
Copyright (C) 1999, William Ferrell and Scott Scriven
|
||||
2001, Andre Breiler
|
||||
2001, Philip Pokorny
|
||||
@@ -64,8 +64,10 @@
|
||||
|
||||
/* MO displays allow 25 keys that map by default to 'A' - 'Y' */
|
||||
#define MAX_KEY_MAP 25
|
||||
// Don't forget to define key mappings in LCDd.conf: KeyMap_A=Enter, ...
|
||||
// otherwise you will not get your keypad working.
|
||||
/*
|
||||
* Don't forget to define key mappings in LCDd.conf: KeyMap_A=Enter, ...
|
||||
* otherwise you will not get your keypad working.
|
||||
*/
|
||||
|
||||
#define IS_LCD_DISPLAY (p->MtxOrb_type == MTXORB_LCD)
|
||||
#define IS_LKD_DISPLAY (p->MtxOrb_type == MTXORB_LKD)
|
||||
@@ -86,14 +88,7 @@
|
||||
* sent to the display across the serial link.
|
||||
*
|
||||
* In order to display graphic widgets, we define and use our own
|
||||
* custom characters. To avoid multiple definitions of the same
|
||||
* custom characters, we use a caching mechanism that remembers
|
||||
* what is currently defined. In order to avoid always redefining
|
||||
* the same custom character at the beginning of the table, we
|
||||
* rotate the beginning of the table. This is supposed to reduce
|
||||
* the number of character redefinitions and make the caching more
|
||||
* effective. The overall goal is to reduce the number of
|
||||
* characters sent to the display.
|
||||
* custom characters.
|
||||
*/
|
||||
|
||||
|
||||
@@ -598,9 +593,6 @@ MtxOrb_clear (Driver *drvthis)
|
||||
/* replace all chars in framebuf with spaces */
|
||||
memset(p->framebuf, ' ', (p->width * p->height));
|
||||
|
||||
/* make backing store differ from framebuf so it all gets cleared by MtxOrb_flush */
|
||||
//memset(p->backingstore, 0xFE, (p->width * p->height));
|
||||
|
||||
debug(RPT_DEBUG, "MtxOrb: cleared screen");
|
||||
}
|
||||
|
||||
@@ -617,11 +609,11 @@ MtxOrb_flush (Driver *drvthis)
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < p->height; i++) {
|
||||
// set pointers to start of the line in frame buffer & backing store
|
||||
/* set pointers to start of the line in frame buffer & backing store */
|
||||
unsigned char *sp = p->framebuf + (i * p->width);
|
||||
unsigned char *sq = p->backingstore + (i * p->width);
|
||||
|
||||
// set pointers to end of the line in frame buffer & backing store
|
||||
/* set pointers to end of the line in frame buffer & backing store */
|
||||
unsigned char *ep = sp + (p->width - 1);
|
||||
unsigned char *eq = sq + (p->width - 1);
|
||||
int length = 0;
|
||||
@@ -634,11 +626,11 @@ MtxOrb_flush (Driver *drvthis)
|
||||
* - leave out leading and trailing parts that are identical
|
||||
*/
|
||||
|
||||
// skip over leading identical portions of the line
|
||||
/* skip over leading identical portions of the line */
|
||||
for (j = 0; (sp <= ep) && (*sp == *sq); sp++, sq++, j++)
|
||||
;
|
||||
|
||||
// skip over trailing identical portions of the line
|
||||
/* skip over trailing identical portions of the line */
|
||||
for (length = p->width - j; (length > 0) && (*ep == *eq); ep--, eq--, length--)
|
||||
;
|
||||
|
||||
@@ -648,7 +640,7 @@ MtxOrb_flush (Driver *drvthis)
|
||||
unsigned char *byte;
|
||||
|
||||
memcpy(out, sp, length);
|
||||
// replace command character \xFE by space
|
||||
/* replace command character \xFE by space */
|
||||
while ((byte = memchr(out, '\xFE', length)) != NULL)
|
||||
*byte = ' ';
|
||||
|
||||
@@ -659,7 +651,7 @@ MtxOrb_flush (Driver *drvthis)
|
||||
write(p->fd, out, length);
|
||||
modified++;
|
||||
}
|
||||
} // i < p->height
|
||||
}
|
||||
|
||||
if (modified)
|
||||
memcpy(p->backingstore, p->framebuf, p->width * p->height);
|
||||
@@ -1117,7 +1109,7 @@ MtxOrb_vbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
memset(vBar, 0x00, sizeof(vBar));
|
||||
|
||||
for (i = 1; i < p->cellheight; i++) {
|
||||
// add pixel line per pixel line ...
|
||||
/* add pixel line per pixel line ... */
|
||||
vBar[p->cellheight - i] = 0xFF;
|
||||
MtxOrb_set_char(drvthis, i, vBar);
|
||||
}
|
||||
@@ -1156,7 +1148,7 @@ MtxOrb_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
memset(hBar, 0x00, sizeof(hBar));
|
||||
|
||||
for (i = 1; i <= p->cellwidth; i++) {
|
||||
// fill pixel columns from left to right.
|
||||
/* fill pixel columns from left to right. */
|
||||
memset(hBar, 0xFF & ~((1 << (p->cellwidth - i)) - 1), sizeof(hBar));
|
||||
MtxOrb_set_char(drvthis, i, hBar);
|
||||
}
|
||||
@@ -1194,7 +1186,7 @@ MtxOrb_num (Driver *drvthis, int x, int num)
|
||||
do_init = 1;
|
||||
}
|
||||
|
||||
// Lib_adv_bignum does everything needed to show the bignumbers.
|
||||
/* Lib_adv_bignum does everything needed to show the bignumbers. */
|
||||
lib_adv_bignum(drvthis, x, num, 0, do_init);
|
||||
}
|
||||
|
||||
@@ -1207,8 +1199,6 @@ MtxOrb_num (Driver *drvthis, int x, int num)
|
||||
MODULE_EXPORT int
|
||||
MtxOrb_get_free_chars (Driver *drvthis)
|
||||
{
|
||||
//PrivateData *p = drvthis->private_data;
|
||||
|
||||
return NUM_CCs;
|
||||
}
|
||||
|
||||
@@ -1256,8 +1246,6 @@ MtxOrb_set_char (Driver *drvthis, int n, unsigned char *dat)
|
||||
MODULE_EXPORT int
|
||||
MtxOrb_icon (Driver *drvthis, int x, int y, int icon)
|
||||
{
|
||||
// PrivateData *p = drvthis->private_data;
|
||||
|
||||
static unsigned char heart_open[] =
|
||||
{ b__XXXXX,
|
||||
b__X_X_X,
|
||||
@@ -1440,12 +1428,12 @@ MtxOrb_cursor (Driver *drvthis, int x, int y, int state)
|
||||
|
||||
/* set cursor state */
|
||||
switch (state) {
|
||||
case CURSOR_OFF: // no cursor
|
||||
case CURSOR_OFF: /* no cursor */
|
||||
write(p->fd, "\xFE" "K", 2);
|
||||
break;
|
||||
case CURSOR_UNDER: // underline cursor
|
||||
case CURSOR_BLOCK: // inverting blinking block
|
||||
case CURSOR_DEFAULT_ON: // blinking block
|
||||
case CURSOR_UNDER: /* underline cursor */
|
||||
case CURSOR_BLOCK: /* inverting blinking block */
|
||||
case CURSOR_DEFAULT_ON: /* blinking block */
|
||||
default:
|
||||
write(p->fd, "\xFE" "J", 2);
|
||||
break;
|
||||
@@ -1461,10 +1449,6 @@ MtxOrb_cursor (Driver *drvthis, int x, int y, int state)
|
||||
* \param drvthis Pointer to driver structure.
|
||||
* \return String representation of the key.
|
||||
* \c NULL if nothing available / unmapped key.
|
||||
*
|
||||
* \todo Recover the code for I2C connectivity to MtxOrb
|
||||
* and don't query the LCD if it does not support keypad.
|
||||
* Otherwise crash of the LCD and/or I2C bus.
|
||||
*/
|
||||
MODULE_EXPORT const char *
|
||||
MtxOrb_get_key (Driver *drvthis)
|
||||
@@ -1473,7 +1457,7 @@ MtxOrb_get_key (Driver *drvthis)
|
||||
char key = 0;
|
||||
struct pollfd fds[1];
|
||||
|
||||
/* don't query the keyboard if there are no mapped keys; see \todo above */
|
||||
/* don't query the keyboard if there are no mapped keys */
|
||||
if ((p->keys == 0) && (!p->keypad_test_mode))
|
||||
return NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user