From 862393188b1eda01abbb9605e4396d9e06b825fd Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Thu, 26 Sep 2013 20:38:17 +0200 Subject: [PATCH] fix the button action Signed-off-by: Olivier Matz --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index e176a1f..82f12d7 100644 --- a/main.c +++ b/main.c @@ -27,7 +27,7 @@ #define RADIO_READ() (!!(PINB & (_BV(RADIO_BIT)))) #define BUTTON_BIT 3 -#define BUTTON_IS_PRESSED() (!!(PINB & (_BV(BUTTON_BIT)))) +#define BUTTON_IS_PRESSED() (!(PINB & (_BV(BUTTON_BIT)))) #define LED_BIT 4 #define LED_ON() PORTB |= _BV(LED_BIT) @@ -359,6 +359,7 @@ static void beep(void) BUZZER_ON(); else BUZZER_OFF(); + wait_period(); } } #endif @@ -382,6 +383,7 @@ int main(void) /* led and buzzer are outputs */ #if defined(__AVR_ATtiny45__) DDRB |= (1 << LED_BIT) | (1 << BUZZER_BIT); + PORTB |= (1 << BUTTON_BIT); /* pull up */ #endif i = 0; @@ -391,6 +393,7 @@ int main(void) /* wait until 200us is elapsed since previous call (5Khz) */ wait_period(); + detected = 0; #ifndef HOST_VERSION /* filter button */ -- 2.30.2