File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,16 @@ static int is_physical_button_pressed()
55
55
56
56
static int is_touch_button_pressed ()
57
57
{
58
- return tsc_read_button (0 ) || tsc_read_button (1 );
58
+ int is_pressed = (tsc_read_button (0 ) || tsc_read_button (1 ));
59
+ #ifndef IS_BOOTLOADER
60
+ if (is_pressed )
61
+ {
62
+ // delay for debounce, and longer than polling timer period.
63
+ delay (95 );
64
+ return (tsc_read_button (0 ) || tsc_read_button (1 ));
65
+ }
66
+ #endif
67
+ return is_pressed ;
59
68
}
60
69
61
70
int (* IS_BUTTON_PRESSED )() = is_physical_button_pressed ;
@@ -66,7 +75,7 @@ static void edge_detect_touch_button()
66
75
uint8_t current_touch = 0 ;
67
76
if (is_touch_button_pressed == IS_BUTTON_PRESSED )
68
77
{
69
- current_touch = IS_BUTTON_PRESSED ( );
78
+ current_touch = ( tsc_read_button ( 0 ) || tsc_read_button ( 1 ) );
70
79
71
80
// 1 sample per 25 ms
72
81
if ((millis () - __last_button_bounce_time ) > 25 )
@@ -153,7 +162,6 @@ void device_set_status(uint32_t status)
153
162
154
163
int device_is_button_pressed ()
155
164
{
156
-
157
165
return IS_BUTTON_PRESSED ();
158
166
}
159
167
You can’t perform that action at this time.
0 commit comments