// ps/2 keyboard decoder on ATMega8, ATMega48 // Copyright 2010-2014, Adrien Destugues // This file is distributed under the terms of the MIT Licence. // Parts borrowed from : // keyboard.c // for NerdKits with ATmega168 // hevans@nerdkits.com #include #include //ps/2 Keyboard pin out //pin 5 - clock //pin 3 - GND //pin 1 - data //pin 4 - VCC //PIN configuration #define PS2_PORT PIND #define PS2_CLK PD3 /* Also INT1 */ #ifdef __AVR_ATtiny2313__ // K4KUSB modified board #define PS2_DATA PD5 #else // ENSSAT IR modified board #define PS2_DATA PD4 #endif static volatile uint8_t char_waiting; static uint8_t started; static uint8_t bit_count; static uint8_t extended; volatile uint8_t kbd_data; uint8_t release; // Interrupt vector - Triggered when there is activity on the clock line ISR(INT1_vect) { //make sure clock line is low, if not ignore this transition if(PS2_PORT & (1<