From c62e6e81d5549609f7ffddcaa5cd6417689dccf6 Mon Sep 17 00:00:00 2001 From: Madcow Date: Sat, 19 Oct 2024 17:54:04 +0200 Subject: [PATCH] Use edge direction constants for clarity --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index fc7a7a2..e41db3c 100644 --- a/src/main.c +++ b/src/main.c @@ -261,13 +261,13 @@ ISR(TIMER3_CAPT_vect) { TCNT3 = 0; edgecap = ICR3; - edgedir = (PIN(B) & BIT(5)) ? 1 : 0; + edgedir = (PIN(B) & BIT(5)) ? E_RISING : E_FALLING; // Must not simply toggle the edge direction bit since // we can miss very quick edge changes and run out of // sync with the actual port state. - TCCR3B = (edgedir) ? 0x02 : 0x42; + TCCR3B = (edgedir == E_RISING) ? 0x02 : 0x42; if (rxstate == S_IDLE) { HandleEdge();