/*************************************************************************** * Copyright (C) 11/2014 by Olaf Rempel * * razzor@kopf-tisch.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; version 2 of the License, * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include "input.h" #include "event.h" /* *********************************************************************** */ static uint8_t pcint_old; static uint8_t quad_state; static uint8_t quad_state_old; static uint8_t debounce_timer[2]; /* *********************************************************************** */ ISR(PCINT1_vect) { uint8_t pcint_new = PINC & PCMSK1; uint8_t pcint = pcint_new ^ pcint_old; uint8_t quad_state_new = quad_state; /* quadruple decoder A changed */ if (pcint & (1< 0) { debounce_timer[0]--; } if (debounce_timer[1] > 0) { debounce_timer[1]--; } } /* input_tick */ void input_init(void) { /* pullup on all inputs */ DDRC &= ~((1<