/* ------------------------------------- Normally only for BOARD ELAVR32, using AD0 as Analog-Digital-Converter for 8 Resistor separated Keys. ------------------------------------- */ #ifndef ___KEY_H #define ___KEY_H #include "global.h" #include "utils.h" //if you will use another channel as channel 0 //like board elavr32, you can define it before. #ifndef KEYADCCHANNEL #define KEYADCCHANNEL 0 #endif #define NOKEY 0 #define KEY_7 '7' #define KEY_6 '6' #define KEY_5 '5' #define KEY_4 '4' #define KEY_3 '3' #define KEY_2 '2' #define KEY_1 '1' #define KEY_0 '0' #define KEY_UP KEY_7 #define KEY_LEFT KEY_6 #define KEY_RIGHT KEY_5 #define KEY_DOWN KEY_4 #define KEY_FUNC0 KEY_3 #define KEY_FUNC1 KEY_2 #define KEY_FUNC2 KEY_1 #define KEY_FUNC3 KEY_0 extern unsigned char testkey( void ); /* reads keyinput. if a key is pressed, tests ist for three times, with a difference of 10 ms between every test. If same key pressed after this tests, function waits till key is released, then it returns the key. Otherwise 0 is returned. */ //this functions requires Delay1ms from utils.c extern unsigned char readkey( void ); #endif