From 783fc720041e5280ce6c0cfe4e92c6fd8090d29f Mon Sep 17 00:00:00 2001 From: uvos Date: Fri, 21 Jan 2022 23:21:28 +0100 Subject: [PATCH] make inital state consistant, dehardcode address --- main.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index 15227b2..6665041 100644 --- a/main.cpp +++ b/main.cpp @@ -50,7 +50,7 @@ static void setTurnout1(bool in) writePin(&PORTB, T1_B, false); } -Decoder decoder(&PINB, PB2, &TCNT1, &handler); +Decoder decoder(&PINB, PB2, &TCNT1, &handler, nullptr, 0x02); ISR(TIMER1_OVF_vect) { @@ -66,14 +66,11 @@ int main() { DDRB = (1 << PB0) | (1 << PB1) | (1 << PB3) | (1 << PB4); - bool turnout0 = false; - bool turnout1 = false; + bool turnout0 = turnout0Flag; + bool turnout1 = turnout1Flag; _delay_ms(100); - setTurnout0(true); - setTurnout1(true); - _delay_ms(500); - setTurnout0(false); - setTurnout1(false); + setTurnout0(turnout0); + setTurnout1(turnout1); MCUCR = (1 << ISC00); //enable rising and falling irq on INT0 GIMSK = (1 << INT0); //unmask INT0