support multi-controller LCDs (only tested with a single-controller LCD)

This commit is contained in:
marschap
2007-04-04 13:14:15 +00:00
parent 327ab00298
commit 3e616e4192
2 changed files with 6 additions and 4 deletions
+5 -3
View File
@@ -28,7 +28,7 @@ static usb_dev_handle *lcd2usb;
// initialize the driver
int
hd_init_lcd2usb (Driver *drvthis)
hd_init_lcd2usb(Driver *drvthis)
{
PrivateData *p = (PrivateData*) drvthis->private_data;
@@ -130,9 +130,11 @@ hd_init_lcd2usb (Driver *drvthis)
void
lcd2usb_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch)
{
int type = (flags == RS_DATA) ? (LCD2USB_DATA | LCD2USB_CTRL_0) : (LCD2USB_CMD | LCD2USB_CTRL_0);
int type = (flags == RS_DATA) ? LCD2USB_DATA : LCD2USB_CMD;
int id = (displayID == 0) ? LCD2USB_CTRL_BOTH
: ((displayID == 1) ? LCD2USB_CTRL_0 : LCD2USB_CTRL_1);
usb_control_msg(lcd2usb, USB_TYPE_VENDOR, type, ch, 0, NULL, 0, 1000);
usb_control_msg(lcd2usb, USB_TYPE_VENDOR, (type | id), ch, 0, NULL, 0, 1000);
}
+1 -1
View File
@@ -11,7 +11,7 @@
/* target is a bit map for CMD/DATA */
#define LCD2USB_CTRL_0 (1<<3)
#define LCD2USB_CTRL_1 (1<<4)
#define LCD2USB_CTRL_BOTH (LCD_CTRL_0 | LCD_CTRL_1)
#define LCD2USB_CTRL_BOTH (LCD2USB_CTRL_0 | LCD2USB_CTRL_1)
#define LCD2USB_ECHO (0<<5)
#define LCD2USB_CMD (1<<5)