Rev 2313 Rev 2314
1 /* mija 2008 1 /* mija 2008
2   2  
3 *.h file for defines key.c 3 *.h file for defines key.c
4   4  
5 key KEY1 5 key KEY1
6 KEY2 6 KEY2
7 KEY3 7 KEY3
8 KEY4 8 KEY4
9   9  
10 !!!!NOTE must be set PIN with PORT and DDR 10 !!!!NOTE must be set PIN with PORT and DDR
11 */ 11 */
12   12  
13 #ifndef __key_h_included__ 13 #ifndef __key_h_included__
14 #define __key_h_included__ 14 #define __key_h_included__
15   15  
16 #define KEYSTABLETIME 5 //umerne rychlosti main smycky cca 16 #define KEYSTABLETIME 5 //umerne rychlosti main smycky cca
17 //pocet opakovani fce procesKey() za cca 30ms 17 //pocet opakovani fce procesKey() za cca 30ms
18 #define KEYFIRSTREPEATTIME 200 18 #define KEYFIRSTREPEATTIME 200
19 #define KEYREPEATTIME 100 19 #define KEYREPEATTIME 100
20   20  
21 #define KEY1 PC0 21 #define KEY1 PC0
22 #define PORT_KEY1 PORTC 22 #define PORT_KEY1 PORTC
23 #define DDR_KEY1 DDRC 23 #define DDR_KEY1 DDRC
24 #define PIN_KEY1 PINC 24 #define PIN_KEY1 PINC
25   25  
26 #define KEY2 PC1 26 #define KEY2 PC1
27 #define PORT_KEY2 PORTC 27 #define PORT_KEY2 PORTC
28 #define DDR_KEY2 DDRC 28 #define DDR_KEY2 DDRC
29 #define PIN_KEY2 PINC 29 #define PIN_KEY2 PINC
30   30  
31 void ProcesKey(uint8_t *key); 31 void ProcesKey(uint8_t *key);
32 void KeyInit(); 32 void KeyInit();
33   33  
34 //******************************************************************* 34 //*******************************************************************
35 //internal 35 //internal
36   36  
37 #define KEY1Input() (!(PIN_KEY1 & (_BV(KEY1)))) 37 #define KEY1Input() (!(PIN_KEY1 & (_BV(KEY1))))
38 #define KEY1Init() DDR_KEY1 &= (~(_BV(KEY1))) 38 #define KEY1Init() DDR_KEY1 &= (~(_BV(KEY1)))
39 #define KEY1Pullup() PORT_KEY1 |= _BV(KEY1) 39 #define KEY1Pullup() PORT_KEY1 |= _BV(KEY1)
40   40  
41 #define KEY2Input() (!(PIN_KEY2 & (_BV(KEY2)))) 41 #define KEY2Input() (!(PIN_KEY2 & (_BV(KEY2))))
42 #define KEY2Init() DDR_KEY2 &= (~(_BV(KEY2))) 42 #define KEY2Init() DDR_KEY2 &= (~(_BV(KEY2)))
43 #define KEY2Pullup() PORT_KEY2 |= _BV(KEY2) 43 #define KEY2Pullup() PORT_KEY2 |= _BV(KEY2)
44   44  
45 #define NOKEY 0 45 #define NOKEY 0
46 #define TL1 1 46 #define TL1 1
47 #define TL2 2 47 #define TL2 2
48 #define TL1TL2 3 48 #define TL1TL2 3
49 //enum{NOKEY=0,TL1,TL2,TL3,TL4,TL1TL2}; 49 //enum{NOKEY=0,TL1,TL2,TL3,TL4,TL1TL2};
50   50  
51 #endif /* __key_h_included__ */ 51 #endif /* __key_h_included__ */