summaryrefslogtreecommitdiff
path: root/src/common/button.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/button.c')
-rw-r--r--src/common/button.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/common/button.c b/src/common/button.c
index adcda43..a733772 100644
--- a/src/common/button.c
+++ b/src/common/button.c
@@ -40,7 +40,7 @@ button_init (void)
/* Button is shared with leds, no PORT init. */
}
-void
+uint16_t
button_wait (void)
{
/* Wait until button is pressed. */
@@ -53,6 +53,7 @@ button_wait (void)
/* Remove pull-up to save battery and shut off leds. */
led_no_pull_up ();
/* Wait until button is really released. */
+ uint16_t press_ms = 0;
uint8_t debounce_ms = 0;
while (debounce_ms < BUTTON_DEBOUNCE_MS)
{
@@ -60,8 +61,13 @@ button_wait (void)
if (IO_GET (BUTTON_IO))
debounce_ms++;
else
+ {
debounce_ms = 0;
+ if (press_ms < 60000)
+ press_ms++;
+ }
}
+ return press_ms;
}
SIGNAL (PCINT0_vect)