Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
730 woggle 1
/*****************************************************************************
2
 *   Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net                  *
3
 *   based on the key handling by Peter Dannegger                            *
4
 *     see www.mikrocontroller.net                                           *
5
 *                                                                           *
6
 *   This program is free software; you can redistribute it and/or modify    *
7
 *   it under the terms of the GNU General Public License as published by    *
8
 *   the Free Software Foundation; either version 2 of the License.          *
9
 *                                                                           *
10
 *   This program is distributed in the hope that it will be useful,         *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
13
 *   GNU General Public License for more details.                            *
14
 *                                                                           *
15
 *   You should have received a copy of the GNU General Public License       *
16
 *   along with this program; if not, write to the                           *
17
 *   Free Software Foundation, Inc.,                                         *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.               *
19
 *                                                                           *
20
 *****************************************************************************/
21
 
22
#ifndef _TIMER_H
23
#define _TIMER_H
24
 
25
#define KEY_PIN                 PINA
26
#define KEY_ENTER               PA7
27
#define KEY_ESC                 PA6
28
#define KEY_PLUS                PA5
29
#define KEY_MINUS               PA4
30
#define KEY_ALL                 ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
31
#define REPEAT_MASK     ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))        // repeat: MODE
32
 
33
#define REPEAT_START    50      // after 500ms
34
#define REPEAT_NEXT             10      // every 100ms
35
 
36
#define ABO_TIMEOUT 300 // 3 sec
37
 
38
extern volatile uint16_t timer;
39
extern volatile uint16_t abo_timer;
40
 
41
void TIMER0_Init (void);
42
 
43
uint8_t get_key_press (uint8_t key_mask);
44
uint8_t get_key_rpt (uint8_t key_mask);
45
uint8_t get_key_short (uint8_t key_mask);
46
uint8_t get_key_long (uint8_t key_mask);
47
uint8_t get_key_long2 (uint8_t key_mask);
48
uint8_t get_key_long_rpt (uint8_t key_mask);
49
 
50
#endif