Use edge direction constants for clarity

This commit is contained in:
2024-10-19 17:54:04 +02:00
committed by GitHub
parent 071779755b
commit c62e6e81d5

View File

@@ -261,13 +261,13 @@ ISR(TIMER3_CAPT_vect)
{ {
TCNT3 = 0; TCNT3 = 0;
edgecap = ICR3; 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 // Must not simply toggle the edge direction bit since
// we can miss very quick edge changes and run out of // we can miss very quick edge changes and run out of
// sync with the actual port state. // sync with the actual port state.
TCCR3B = (edgedir) ? 0x02 : 0x42; TCCR3B = (edgedir == E_RISING) ? 0x02 : 0x42;
if (rxstate == S_IDLE) { if (rxstate == S_IDLE) {
HandleEdge(); HandleEdge();