Fix several problems with data escape handling in hd44780-serial:

1. A bogus address calculation was done (spotted by G. Smith).
2. The displayID was added to the data escape character even if the connection
type does not support multiple displays (spotted by G. Smith).
3. When calculation if data escape is necessary, the character 0xff could not
be escaped. Changed an updates all connection types (M. Dolze).
This commit is contained in:
mmdolze
2014-02-10 06:48:44 +00:00
parent dca261e98a
commit a8d9504a3c
3 changed files with 7 additions and 5 deletions
+1
View File
@@ -19,6 +19,7 @@ v0.5dev (ongoing development)
+ glcd driver: 'picolcdgfx' for picoLCD 256x64 from Mini-Box.com (S. Meharg)
* picolcd: Improvements to IR processing (M. Jones)
+ hd44780: Added 'spi' connection type (S. Dawson)
* hd55780/serial: Change data escape handling (G. Smith)
v0.5.6
- Remove deprecated CFontz633 driver. Use CFontzPacket with Model=633 instead!
+3 -2
View File
@@ -280,9 +280,10 @@ serial_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char f
/* Do we need a DATA indicator byte? */
if ((SERIAL_IF.data_escape != '\0') &&
(((ch >= SERIAL_IF.data_escape_min) &&
(ch < SERIAL_IF.data_escape_max)) ||
(ch <= SERIAL_IF.data_escape_max)) ||
(SERIAL_IF.multiple_displays && displayID != lastdisplayID))) {
write(p->fd, &SERIAL_IF.data_escape + displayID, 1);
unsigned char esc_ch = SERIAL_IF.data_escape + (SERIAL_IF.multiple_displays) ? displayID : 0;
write(p->fd, &esc_ch, 1);
}
write(p->fd, &ch, 1);
}
+3 -3
View File
@@ -23,7 +23,7 @@ struct hd44780_SerialInterface {
unsigned char instruction_escape; /**< Instruction escape character. */
unsigned char data_escape; /**< Data escape character. */
unsigned char data_escape_min; /**< Escaped data lower limit (inclusive) */
unsigned char data_escape_max; /**< Escaped data upper limit (exclusive) */
unsigned char data_escape_max; /**< Escaped data upper limit (inclusive) */
/**@}*/
unsigned int default_bitrate; /**< Bitrate device is set to by default */
@@ -66,11 +66,11 @@ struct hd44780_SerialInterface {
*/
static const struct hd44780_SerialInterface serial_interfaces[] = {
/* type instr data v ^ bitrate bits K esc B Besc Boff Bon Multi End */
{ HD44780_CT_PICANLCD, 0x11, 0x12, 0x00, 0x20, 9600, 8, 0, 0x00, 0, 0, 0, 0, 0, 0 },
{ HD44780_CT_PICANLCD, 0x11, 0x12, 0x00, 0x1F, 9600, 8, 0, 0x00, 0, 0, 0, 0, 0, 0 },
{ HD44780_CT_LCDSERIALIZER, 0xFE, 0, 0x00, 0x00, 9600, 8, 0, 0x00, 0, 0, 0, 0, 0, 0 },
{ HD44780_CT_LOS_PANEL, 0xFE, 0, 0x00, 0x00, 9600, 4, 1, 0xFE, 1, 0xFD, 0, 0xFF, 0, 0 },
{ HD44780_CT_VDR_LCD, 0xFE, 0, 0x00, 0x00, 9600, 4, 0, 0x00, 0, 0, 0, 0, 0, 0 },
{ HD44780_CT_VDR_WAKEUP, 0xC0, 0xC4, 0xC0, 0xD0, 9600, 4, 0, 0x00, 1, 0, 0xC9, 0xC8, 1, 0xCF },
{ HD44780_CT_VDR_WAKEUP, 0xC0, 0xC4, 0xC0, 0xCF, 9600, 4, 0, 0x00, 1, 0, 0xC9, 0xC8, 1, 0xCF },
{ HD44780_CT_PERTELIAN, 0xFE, 0, 0x00, 0x00, 9600, 8, 0, 0x00, 1, 0xFE, 0x02, 0x03, 0, 0 },
{ HD44780_CT_UNKNOWN, 0x00, 0, 0x00, 0x00, 0, 0, 0, 0, 0, 0x00, 0x00, 0x00, 0, 0 }
};