Skip to content

Commit d2153aa

Browse files
committed
suspend interrupts while reading touch, hopefully fixes #1
1 parent da1de05 commit d2153aa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

firmware/TouchwheelSAO_attiny816/TouchyTouch.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,16 @@ class TouchyTouch
122122
digitalWrite(pin, HIGH);
123123
delayMicroseconds(CHARGE_MICROS);
124124
// set pad back to an input and take some samples
125+
noInterrupts();
125126
pinMode(pin, INPUT);
126127
while ( digitalRead(pin) ) {
127128
if (ticks >= TIMEOUT_TICKS) {
129+
interrupts();
128130
return TIMEOUT_TICKS;
129131
}
130132
ticks++;
131133
}
134+
interrupts();
132135
}
133136
return ticks;
134137
}

0 commit comments

Comments
 (0)