summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/button.c19
-rw-r--r--firmware/export/button.h2
2 files changed, 18 insertions, 3 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 7d4daaf..6fbe5de 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -81,6 +81,9 @@ static int button_read(int *data);
static int button_read(void);
#endif
+#ifdef HAVE_TOUCHSCREEN
+ int last_touchscreen_touch;
+#endif
#if defined(HAVE_HEADPHONE_DETECTION)
static struct timeout hp_detect_timeout; /* Debouncer for headphone plug/unplug */
/* This callback can be used for many different functions if needed -
@@ -406,7 +409,9 @@ void button_init(void)
remote_filter_first_keypress = false;
#endif
#endif
-
+#ifdef HAVE_TOUCHSCREEN
+ last_touchscreen_touch = 0xffff;
+#endif
/* Start polling last */
tick_add_task(button_tick);
}
@@ -522,7 +527,10 @@ static int button_read(void)
if (btn && flipped)
btn = button_flip(btn); /* swap upside down */
#endif
-
+#ifdef HAVE_TOUCHSCREEN
+ if (btn & BUTTON_TOUCHSCREEN)
+ last_touchscreen_touch = current_tick;
+#endif
/* Filter the button status. It is only accepted if we get the same
status twice in a row. */
#ifndef HAVE_TOUCHSCREEN
@@ -536,7 +544,6 @@ static int button_read(void)
return retval;
}
-
int button_status(void)
{
return lastbtn;
@@ -547,6 +554,12 @@ void button_clear_queue(void)
queue_clear(&button_queue);
}
+#ifdef HAVE_TOUCHSCREEN
+int touchscreen_last_touch(void)
+{
+ return last_touchscreen_touch;
+}
+#endif
#endif /* SIMULATOR */
#ifdef HAVE_WHEEL_ACCELERATION
diff --git a/firmware/export/button.h b/firmware/export/button.h
index d5a8001..3947f07 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -68,6 +68,8 @@ int button_apply_acceleration(const unsigned int data);
#define BUTTON_TOUCHSCREEN 0x08000000
#ifdef HAVE_TOUCHSCREEN
+int touchscreen_last_touch(void);
+
#if (!defined(BUTTON_TOPLEFT) || !defined(BUTTON_TOPMIDDLE) \
|| !defined(BUTTON_TOPRIGHT) || !defined(BUTTON_MIDLEFT) \
|| !defined(BUTTON_CENTER) || !defined(BUTTON_MIDRIGHT) \