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