Subversion Repositories Projects

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1465 - 1
 
2
/************************************************************************/
3
/*                                                                                                                                                                                                                                                                                      */
4
/*                                                                                      Debouncing 8 Keys                                                                                                                               */
5
/*                                                                                      Sampling 4 Times                                                                                                                                */
6
/*                                                                                      With Repeat Function                                                                                                            */
7
/*                                                                                                                                                                                                                                                                                      */
8
/*                                                      Author: Peter Dannegger                                                                                                                                 */
9
/*                                                                                      danni@specs.de                                                                                                                                  */
10
/*                                                                                                                                                                                                                                                                                      */
11
/*               Ergänzt: gebad, beschschleunigende Tastenwiederholung                                          */
12
/*                                                                                                                                                                                                                                                                                      */
13
/************************************************************************/
14
 
15
#ifndef KEYS_H_
16
#define KEYS_H_
17
 
18
#define REPEAT_START    50                                                                                      // after 500ms
19
#define REPEAT_NEXT             20                                                                                      // every 200ms
20
#define REPEAT_ACC_N    6                                                                                               // wenn V_REPEAT, nach dem angegebenen Zeichen beschleunigen
21
 
22
volatile uint8_t key_state;                                                                             // debounced and inverted key state:
23
                                                                                                                                                                                        // bit = 1: key pressed
24
volatile uint8_t key_press;                                                                             // key press detect
25
volatile uint8_t key_rpt;                                                                                       // key long press and repeat
26
volatile uint8_t key_repeat_next;
27
volatile uint8_t key_counter;
28
 
29
volatile uint8_t task_timer0_1;
30
volatile uint8_t task_timer0_2;
31
volatile uint8_t task_timer0_3;
32
volatile uint8_t task_timer0_4;
33
volatile uint8_t task_timer0_5;
34
 
35
uint8_t Get_Key_Press( uint8_t key_mask );
36
uint8_t Get_Key_Rpt( uint8_t key_mask );
37
uint8_t Get_Key_Short( uint8_t key_mask );
38
uint8_t Get_Key_Long( uint8_t key_mask );
39
void Key_Speedup_rpt( uint8_t speedup );
40
 
41
volatile uint16_t light_count;                                                          // muss bei jeden Tastendruck auf 0 gesetzt werdwn
42
 
43
#endif /* KEYS_H_ */