1
0
mirror of https://github.com/sjlongland/atinysynth.git synced 2025-11-02 03:41:40 +10:00

main: timer: Invert button states

There's a pull-up with the button asserting a logic low, so invert the
inputs.
This commit is contained in:
Stuart Longland 2017-05-27 15:01:41 +10:00
parent f8346cdea9
commit f2fac87ba3
Signed by: stuartl
GPG Key ID: F954BBBB7948D546

View File

@ -141,7 +141,7 @@ ISR(TIMER0_COMPA_vect) {
/* We are reading inputs */ /* We are reading inputs */
uint8_t diff; uint8_t diff;
button_last = button_state; button_last = button_state;
button_state = PINA; button_state = ~PINA;
/* Determine differences from last */ /* Determine differences from last */
diff = button_state ^ button_last; diff = button_state ^ button_last;
/* Detect button presses & releases */ /* Detect button presses & releases */
@ -161,7 +161,7 @@ ISR(TIMER0_COMPA_vect) {
PORTB |= GPIO_EN; PORTB |= GPIO_EN;
/* Wait for latch */ /* Wait for latch */
_delay_us(1); _delay_us(1);
/* Switch pin direction */ /* Switch to reading inputs */
DDRA = 0x00; DDRA = 0x00;
} }