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 7d4daafdc2..6fbe5de229 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -81,6 +81,9 @@ static int button_read(int *data);
81static int button_read(void); 81static int button_read(void);
82#endif 82#endif
83 83
84#ifdef HAVE_TOUCHSCREEN
85 int last_touchscreen_touch;
86#endif
84#if defined(HAVE_HEADPHONE_DETECTION) 87#if defined(HAVE_HEADPHONE_DETECTION)
85static struct timeout hp_detect_timeout; /* Debouncer for headphone plug/unplug */ 88static struct timeout hp_detect_timeout; /* Debouncer for headphone plug/unplug */
86/* This callback can be used for many different functions if needed - 89/* This callback can be used for many different functions if needed -
@@ -406,7 +409,9 @@ void button_init(void)
406 remote_filter_first_keypress = false; 409 remote_filter_first_keypress = false;
407#endif 410#endif
408#endif 411#endif
409 412#ifdef HAVE_TOUCHSCREEN
413 last_touchscreen_touch = 0xffff;
414#endif
410 /* Start polling last */ 415 /* Start polling last */
411 tick_add_task(button_tick); 416 tick_add_task(button_tick);
412} 417}
@@ -522,7 +527,10 @@ static int button_read(void)
522 if (btn && flipped) 527 if (btn && flipped)
523 btn = button_flip(btn); /* swap upside down */ 528 btn = button_flip(btn); /* swap upside down */
524#endif 529#endif
525 530#ifdef HAVE_TOUCHSCREEN
531 if (btn & BUTTON_TOUCHSCREEN)
532 last_touchscreen_touch = current_tick;
533#endif
526 /* Filter the button status. It is only accepted if we get the same 534 /* Filter the button status. It is only accepted if we get the same
527 status twice in a row. */ 535 status twice in a row. */
528#ifndef HAVE_TOUCHSCREEN 536#ifndef HAVE_TOUCHSCREEN
@@ -536,7 +544,6 @@ static int button_read(void)
536 return retval; 544 return retval;
537} 545}
538 546
539
540int button_status(void) 547int button_status(void)
541{ 548{
542 return lastbtn; 549 return lastbtn;
@@ -547,6 +554,12 @@ void button_clear_queue(void)
547 queue_clear(&button_queue); 554 queue_clear(&button_queue);
548} 555}
549 556
557#ifdef HAVE_TOUCHSCREEN
558int touchscreen_last_touch(void)
559{
560 return last_touchscreen_touch;
561}
562#endif
550#endif /* SIMULATOR */ 563#endif /* SIMULATOR */
551 564
552#ifdef HAVE_WHEEL_ACCELERATION 565#ifdef HAVE_WHEEL_ACCELERATION
diff --git a/firmware/export/button.h b/firmware/export/button.h
index d5a8001fb7..3947f07207 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -68,6 +68,8 @@ int button_apply_acceleration(const unsigned int data);
68#define BUTTON_TOUCHSCREEN 0x08000000 68#define BUTTON_TOUCHSCREEN 0x08000000
69 69
70#ifdef HAVE_TOUCHSCREEN 70#ifdef HAVE_TOUCHSCREEN
71int touchscreen_last_touch(void);
72
71#if (!defined(BUTTON_TOPLEFT) || !defined(BUTTON_TOPMIDDLE) \ 73#if (!defined(BUTTON_TOPLEFT) || !defined(BUTTON_TOPMIDDLE) \
72 || !defined(BUTTON_TOPRIGHT) || !defined(BUTTON_MIDLEFT) \ 74 || !defined(BUTTON_TOPRIGHT) || !defined(BUTTON_MIDLEFT) \
73 || !defined(BUTTON_CENTER) || !defined(BUTTON_MIDRIGHT) \ 75 || !defined(BUTTON_CENTER) || !defined(BUTTON_MIDRIGHT) \