Skip to content

Commit abe306a

Browse files
committed
Merge branch 'master' of github.com:solokeys/solo
2 parents 41ceb78 + 8e192f2 commit abe306a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

targets/stm32l432/src/device.c

+11-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,16 @@ static int is_physical_button_pressed()
5555

5656
static int is_touch_button_pressed()
5757
{
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;
5968
}
6069

6170
int (*IS_BUTTON_PRESSED)() = is_physical_button_pressed;
@@ -66,7 +75,7 @@ static void edge_detect_touch_button()
6675
uint8_t current_touch = 0;
6776
if (is_touch_button_pressed == IS_BUTTON_PRESSED)
6877
{
69-
current_touch = IS_BUTTON_PRESSED();
78+
current_touch = (tsc_read_button(0) || tsc_read_button(1));
7079

7180
// 1 sample per 25 ms
7281
if ((millis() - __last_button_bounce_time) > 25)
@@ -153,7 +162,6 @@ void device_set_status(uint32_t status)
153162

154163
int device_is_button_pressed()
155164
{
156-
157165
return IS_BUTTON_PRESSED();
158166
}
159167

0 commit comments

Comments
 (0)