Skip to content

Commit

Permalink
suspend interrupts while reading touch, hopefully fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
todbot committed Nov 10, 2024
1 parent da1de05 commit d2153aa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions firmware/TouchwheelSAO_attiny816/TouchyTouch.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,16 @@ class TouchyTouch
digitalWrite(pin, HIGH);
delayMicroseconds(CHARGE_MICROS);
// set pad back to an input and take some samples
noInterrupts();
pinMode(pin, INPUT);
while ( digitalRead(pin) ) {
if (ticks >= TIMEOUT_TICKS) {
interrupts();
return TIMEOUT_TICKS;
}
ticks++;
}
interrupts();
}
return ticks;
}
Expand Down

0 comments on commit d2153aa

Please sign in to comment.