summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2009-10-05 02:09:00 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2009-10-05 02:09:00 +0000
commitfb50f468666958564656386b7181a4973e042ebc (patch)
tree41aa7fc0b690d2690acf281ce3094d1de10c54fb
parent436776ebb8645f4393bafd01856d7ba2abe83356 (diff)
downloadrockbox-fb50f468666958564656386b7181a4973e042ebc.tar.gz
rockbox-fb50f468666958564656386b7181a4973e042ebc.zip
Button Driver: Add button_status support with data - allows for reading the /immediate/ value of the touchscreen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22933 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h2
-rw-r--r--firmware/drivers/button.c10
-rw-r--r--firmware/export/button.h3
4 files changed, 17 insertions, 0 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 945e99ec71..c37b2fb29b 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -668,6 +668,8 @@ static const struct plugin_api rockbox_api = {
668 appsversion, 668 appsversion,
669 /* new stuff at the end, sort into place next time 669 /* new stuff at the end, sort into place next time
670 the API gets incompatible */ 670 the API gets incompatible */
671
672 button_status_wdata,
671}; 673};
672 674
673int plugin_load(const char* plugin, const void* parameter) 675int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 766a309c01..344026f986 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -836,6 +836,8 @@ struct plugin_api {
836 const char *appsversion; 836 const char *appsversion;
837 /* new stuff at the end, sort into place next time 837 /* new stuff at the end, sort into place next time
838 the API gets incompatible */ 838 the API gets incompatible */
839
840 int (*button_status_wdata)(int *pdata);
839}; 841};
840 842
841/* plugin header */ 843/* plugin header */
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index cc8a1b561a..6e30cb116d 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -86,6 +86,7 @@ static int button_read(void);
86 86
87#ifdef HAVE_TOUCHSCREEN 87#ifdef HAVE_TOUCHSCREEN
88static int last_touchscreen_touch; 88static int last_touchscreen_touch;
89static int lastdata = 0;
89#endif 90#endif
90#if defined(HAVE_HEADPHONE_DETECTION) 91#if defined(HAVE_HEADPHONE_DETECTION)
91static struct timeout hp_detect_timeout; /* Debouncer for headphone plug/unplug */ 92static struct timeout hp_detect_timeout; /* Debouncer for headphone plug/unplug */
@@ -304,6 +305,7 @@ static void button_tick(void)
304 } 305 }
305 } 306 }
306 lastbtn = btn & ~(BUTTON_REL | BUTTON_REPEAT); 307 lastbtn = btn & ~(BUTTON_REL | BUTTON_REPEAT);
308 lastdata = data;
307} 309}
308 310
309#ifdef HAVE_ADJUSTABLE_CPU_FREQ 311#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -575,6 +577,14 @@ int button_status(void)
575 return lastbtn; 577 return lastbtn;
576} 578}
577 579
580#ifdef HAVE_BUTTON_DATA
581int button_status_wdata(int *pdata)
582{
583 *pdata = lastdata;
584 return lastbtn;
585}
586#endif
587
578void button_clear_queue(void) 588void button_clear_queue(void)
579{ 589{
580 queue_clear(&button_queue); 590 queue_clear(&button_queue);
diff --git a/firmware/export/button.h b/firmware/export/button.h
index 3947f07207..3aac1af9d6 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -37,6 +37,9 @@ long button_get (bool block);
37long button_get_w_tmo(int ticks); 37long button_get_w_tmo(int ticks);
38intptr_t button_get_data(void); 38intptr_t button_get_data(void);
39int button_status(void); 39int button_status(void);
40#ifdef HAVE_BUTTON_DATA
41int button_status_wdata(int *pdata);
42#endif
40void button_clear_queue(void); 43void button_clear_queue(void);
41#ifdef HAVE_LCD_BITMAP 44#ifdef HAVE_LCD_BITMAP
42void button_set_flip(bool flip); /* turn 180 degrees */ 45void button_set_flip(bool flip); /* turn 180 degrees */