aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2008-10-06 04:29:12 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2008-10-06 04:29:12 +0000
commita80978985167df7650209888a5a89ea8089c091d (patch)
tree65b31609dee978fb320fe5249eddbc40203d5be2
parentc43556a211b45fefe29b73d912c7cc6ff6d8bfdf (diff)
downloadlcd4linux-a80978985167df7650209888a5a89ea8089c091d.tar.gz
adding GPI to picoLCD for reading button events by Igor Mammedov <niallain@gmail.com>
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@898 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--drv_picoLCD.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drv_picoLCD.c b/drv_picoLCD.c
index 85031f4..c567518 100644
--- a/drv_picoLCD.c
+++ b/drv_picoLCD.c
@@ -162,6 +162,12 @@ static void drv_pL_send(unsigned char *data, int size)
usb_interrupt_write(lcd, USB_ENDPOINT_OUT + 1, (char *) data, size, 1000);
}
+static int drv_pL_read(unsigned char *data, int size)
+{
+ return usb_interrupt_read(lcd, USB_ENDPOINT_OUT + 1, (char *) data, size, 1000);
+}
+
+
static void drv_pL_clear(void)
{
@@ -200,6 +206,20 @@ static int drv_pL_backlight(int backlight)
return backlight;
}
+#define _USBLCD_MAX_DATA_LEN 24
+#define IN_REPORT_KEY_STATE 0x11
+static int drv_pL_gpi(int num)
+{
+ int ret;
+ unsigned char read_packet[_USBLCD_MAX_DATA_LEN];
+ ret = drv_pL_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_pL_gpo(int num, int val)
{
unsigned char cmd[2] = { 0x81 }; /* set GPO */
@@ -343,7 +363,6 @@ static void plugin_gpo(RESULT * result, RESULT * argv[])
SetResult(&result, R_NUMBER, &gpo);
}
-
/****************************************/
/*** widget callbacks ***/
/****************************************/
@@ -381,6 +400,7 @@ int drv_pL_init(const char *section, const int quiet)
CHARS = 8; /* number of user-defineable characters */
CHAR0 = 0; /* ASCII of first user-defineable char */
GPOS = 8;
+ GPIS = 1;
INVALIDATE = 1;
GOTO_COST = 2; /* number of bytes a goto command requires */
@@ -388,6 +408,7 @@ int drv_pL_init(const char *section, const int quiet)
drv_generic_text_real_write = drv_pL_write;
drv_generic_text_real_defchar = drv_pL_defchar;
drv_generic_gpio_real_set = drv_pL_gpo;
+ drv_generic_gpio_real_get = drv_pL_gpi;
/* start display */
if ((ret = drv_pL_start(section, quiet)) != 0)
7-23 01:07:18 +0100'>2014-07-23Imported Upstream version 0+git20140611.14bd6c7upstream/0+git20140611.14bd6c7Jonathan McCrohan7-11/+60 2014-05-13New Upstream Snapshot (commit 1246b27)Jonathan McCrohan1-0/+6 2014-05-13Imported Upstream version 0+git20140512.1246b27upstream/0+git20140512.1246b27Jonathan McCrohan391-301/+3983 2014-04-05Release 0+git20140326.cfc2975-1debian/0+git20140326.cfc2975-1Jonathan McCrohan1-2/+2 2014-04-05d/control: update Homepage (upstream has moved from Gitweb to cgit)Jonathan McCrohan2-1/+2 2014-04-05New Upstream Snapshot (commit cfc2975)Jonathan McCrohan1-0/+6 2014-04-05Imported Upstream version 0+git20140326.cfc2975upstream/0+git20140326.cfc2975Jonathan McCrohan118-656/+877 2014-01-16Release 0+git20140107.1850cf8-1debian/0+git20140107.1850cf8-1Jonathan McCrohan1-2/+2 2014-01-16Update Standards Version to 3.9.5Jonathan McCrohan2-1/+9