diff options
author | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2009-02-28 06:09:05 +0000 |
---|---|---|
committer | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2009-02-28 06:09:05 +0000 |
commit | 71247fb889470f4f35ab745f02c4dd038da1b463 (patch) | |
tree | cd04f68a3bd254f6fb2fb95fa086060526de8b56 /drv_picoLCDGraphic.c | |
parent | 49aa9b7a80687a9ac15dc348308b58c8b108f92e (diff) | |
download | lcd4linux-71247fb889470f4f35ab745f02c4dd038da1b463.tar.gz |
patch for picoLCDGraphics that adds keypad/gpi/gpo capabilities from Nicu Pavel
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@985 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'drv_picoLCDGraphic.c')
-rw-r--r-- | drv_picoLCDGraphic.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/drv_picoLCDGraphic.c b/drv_picoLCDGraphic.c index ec54c4a..0577337 100644 --- a/drv_picoLCDGraphic.c +++ b/drv_picoLCDGraphic.c @@ -6,7 +6,7 @@ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at> * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net> * - * Copyright (C) 2008 Nicu Pavel, Mini-Box.com <npavel@mini-box.com> + * Copyright (C) 2009 Nicu Pavel, Mini-Box.com <npavel@mini-box.com> * * This file is part of LCD4Linux. * @@ -98,7 +98,8 @@ static char *Buffer; static char *BufPtr; static usb_dev_handle *lcd; - +//extern int usb_debug; +int usb_debug; /****************************************/ @@ -119,7 +120,7 @@ static int drv_pLG_open(void) info("%s: scanning for picoLCD 256x64...", Name); - usb_set_debug(0); + usb_debug = 0; usb_init(); usb_find_busses(); @@ -169,6 +170,11 @@ static int drv_pLG_open(void) return -1; } +static int drv_pLG_read(unsigned char *data, int size) +{ + return usb_interrupt_read(lcd, USB_ENDPOINT_IN + 1, (char *) data, size, 1000); +} + static void drv_pLG_send(unsigned char *data, int size) { @@ -388,6 +394,22 @@ static int drv_pLG_backlight(int backlight) return backlight; } +#define _USBLCD_MAX_DATA_LEN 24 +#define IN_REPORT_KEY_STATE 0x11 +static int drv_pLG_gpi( __attribute__ ((unused)) + int num) +{ + int ret; + unsigned char read_packet[_USBLCD_MAX_DATA_LEN]; + ret = drv_pLG_read(read_packet, _USBLCD_MAX_DATA_LEN); + if ((ret > 0) && (read_packet[0] == IN_REPORT_KEY_STATE)) { + debug("picoLCD: pressed key= 0x%02x\n", read_packet[1]); + return read_packet[1]; + } + return 0; +} + + static int drv_pLG_gpo(int num, int val) { unsigned char cmd[2] = { 0x81 }; /* set GPO */ @@ -409,7 +431,7 @@ static int drv_pLG_gpo(int num, int val) gpo &= ~(1 << num); cmd[1] = gpo; - //drv_pLG_send(cmd, 2); + drv_pLG_send(cmd, 2); return val; } @@ -549,9 +571,12 @@ int drv_pLG_init(const char *section, const int quiet) XRES = 6; /* pixel width of one char */ YRES = 8; /* pixel height of one char */ GPOS = 8; - + GPIS = 1; /* real worker functions */ drv_generic_graphic_real_blit = drv_pLG_blit; + drv_generic_gpio_real_set = drv_pLG_gpo; + drv_generic_gpio_real_get = drv_pLG_gpi; + /* start display */ if ((ret = drv_pLG_start(section, quiet)) != 0) |