Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1053 | - | 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 | |||
27 | #if defined HWVERSION1_2 || defined HWVERSION1_3 || defined HWVERSION3_2 |
||
28 | #define KEY_ENTER PA7 |
||
29 | #define KEY_ESC PA6 |
||
30 | #define KEY_PLUS PA5 |
||
31 | #define KEY_MINUS PA4 |
||
32 | #endif |
||
33 | |||
34 | #ifdef HWVERSION3_1 /*in der Hardwareversion sind die Tasten im Layout verdreht*/ |
||
35 | #define KEY_ENTER PA4 |
||
36 | #define KEY_ESC PA5 |
||
37 | #define KEY_PLUS PA6 |
||
38 | #define KEY_MINUS PA7 |
||
39 | #endif |
||
40 | |||
41 | #define KEY_ALL ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC)) |
||
42 | #define REPEAT_MASK ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC)) // repeat: MODE |
||
43 | |||
44 | #define REPEAT_START 50 // after 500ms |
||
45 | #define REPEAT_NEXT 10 // every 100ms |
||
46 | |||
47 | #define ABO_TIMEOUT 300 // 3 sec |
||
48 | extern volatile uint8_t Display_on; |
||
49 | |||
50 | extern volatile uint16_t timer; |
||
51 | extern volatile uint16_t abo_timer; |
||
52 | |||
53 | |||
54 | extern uint16_t minocr_a; |
||
55 | extern uint16_t maxocr_a; |
||
56 | extern uint16_t minocr_b; |
||
57 | extern uint16_t maxocr_b; |
||
58 | |||
59 | |||
60 | void TIMER0_Init (void); |
||
61 | void TIMER1_Init (void); |
||
62 | |||
63 | uint8_t get_key_press (uint8_t key_mask); |
||
64 | uint8_t get_key_rpt (uint8_t key_mask); |
||
65 | uint8_t get_key_short (uint8_t key_mask); |
||
66 | uint8_t get_key_long (uint8_t key_mask); |
||
67 | uint8_t get_key_long2 (uint8_t key_mask); |
||
68 | uint8_t get_key_long_rpt (uint8_t key_mask); |
||
69 | |||
70 | void set_pwm_a (uint16_t); |
||
71 | void set_pwm_b (uint8_t); |
||
72 | |||
73 | #endif |