From: Olivier Matz Date: Thu, 26 Sep 2013 18:38:17 +0000 (+0200) Subject: fix the button action X-Git-Url: http://git.droids-corp.org/?p=beacon-rx-433.git;a=commitdiff_plain;h=862393188b1eda01abbb9605e4396d9e06b825fd fix the button action Signed-off-by: Olivier Matz --- 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 */