more flexible handling of Backlight/brightness
This commit is contained in:
@@ -266,10 +266,18 @@ void
|
||||
serial_HD44780_backlight (PrivateData *p, unsigned char state)
|
||||
{
|
||||
if (p->have_backlight) {
|
||||
unsigned char send[1];
|
||||
send[0] = state ? SERIAL_IF.backlight_on : SERIAL_IF.backlight_off;
|
||||
write(p->fd, &send, 1);
|
||||
}
|
||||
if (SERIAL_IF.backlight_escape) {
|
||||
unsigned char send[2];
|
||||
send[0] = SERIAL_IF.backlight_escape;
|
||||
send[1] = state ? 0 : 0xFF;
|
||||
write(p->fd, &send, 2);
|
||||
}
|
||||
else {
|
||||
unsigned char send[1];
|
||||
send[0] = state ? SERIAL_IF.backlight_on : SERIAL_IF.backlight_off;
|
||||
write(p->fd, &send, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char
|
||||
|
||||
@@ -18,20 +18,21 @@ typedef struct SerialInterface {
|
||||
char keypad;
|
||||
char keypad_escape;
|
||||
char backlight;
|
||||
char backlight_off;
|
||||
char backlight_on;
|
||||
char backlight_escape; /* leave to 0 is the interface uses on/off codes */
|
||||
char backlight_off;
|
||||
char backlight_on; /* leave these two to 0 is backlight_escape is set */
|
||||
char multiple_displays;
|
||||
} SerialInterface;
|
||||
|
||||
/* List of connectiontypes managed by this driver, if you change
|
||||
something here, remember also to change hd44780-drivers.h */
|
||||
static const SerialInterface serial_interfaces[] = {
|
||||
/* name instr data v ^ bitrate bits K esc B Boff Bon Multi */
|
||||
{ "picanlcd", 0x11, 0x12, 0x00, 0x20, 9600, 8, 0, 0x00, 0, 0, 0, 0 },
|
||||
{ "lcdserializer", 0xFE, 0, 0x00, 0x00, 9600, 8, 0, 0x00, 0, 0, 0, 0 },
|
||||
{ "los-panel", 0xFE, 0, 0x00, 0x00, 9600, 4, 1, 0xFE, 0, 0, 0, 0 },
|
||||
{ "vdr-lcd", 0xFE, 0, 0x00, 0x00, 9600, 4, 0, 0x00, 0, 0, 0, 0 },
|
||||
{ "vdr-wakeup", 0xC0, 0xC4, 0xC0, 0xD0, 9600, 4, 0, 0x00, 1, 0xC9, 0xC8, 1 }
|
||||
/* name instr data v ^ bitrate bits K esc B Besc Boff Bon Multi */
|
||||
{ "picanlcd", 0x11, 0x12, 0x00, 0x20, 9600, 8, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ "lcdserializer", 0xFE, 0, 0x00, 0x00, 9600, 8, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ "los-panel", 0xFE, 0, 0x00, 0x00, 9600, 4, 1, 0xFE, 1, 0xFF, 0, 0, 0 },
|
||||
{ "vdr-lcd", 0xFE, 0, 0x00, 0x00, 9600, 4, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ "vdr-wakeup", 0xC0, 0xC4, 0xC0, 0xD0, 9600, 4, 0, 0x00, 1, 0, 0xC9, 0xC8, 1 }
|
||||
};
|
||||
|
||||
/* initialize this particular driver */
|
||||
|
||||
Reference in New Issue
Block a user