Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1470 - 1
/*****************************************************************************
2
 *   Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de                  *
3
 *   Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net                  *
4
 *   based on the key handling by Peter Dannegger                            *
5
 *     see www.mikrocontroller.net                                           *
6
 *   Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net *
7
 *   Copyright (C) 2011 Harald Bongartz                                      *
8
 *                                                                           *
9
 *   This program is free software; you can redistribute it and/or modify    *
10
 *   it under the terms of the GNU General Public License as published by    *
11
 *   the Free Software Foundation; either version 2 of the License.          *
12
 *                                                                           *
13
 *   This program is distributed in the hope that it will be useful,         *
14
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
15
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
16
 *   GNU General Public License for more details.                            *
17
 *                                                                           *
18
 *   You should have received a copy of the GNU General Public License       *
19
 *   along with this program; if not, write to the                           *
20
 *   Free Software Foundation, Inc.,                                         *
21
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.               *
22
 *                                                                           *
23
 *                                                                           *
24
 *   Credits to:                                                             *
25
 *   Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN  *
26
 *                          http://www.mikrokopter.de                        *
27
 *   Gregor "killagreg" Stobrawa for his version of the MK code              *
28
 *   Thomas Kaiser "thkais" for the original project. See                    *
29
 *                          http://www.ft-fanpage.de/mikrokopter/            *
30
 *                          http://forum.mikrokopter.de/topic-4061-1.html    *
31
 *   Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code *
32
 *                          http://www.mylifesucks.de/oss/c-osd/             *
33
 *   Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility*
34
 *****************************************************************************/
35
 
36
#ifndef _TIMER_H
37
#define _TIMER_H
38
 
39
#include "cpu.h"
40
#include "main.h"
41
 
42
#define KEY_ALL             ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
43
#define LONG_MASK           ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
44
#define REPEAT_MASK         ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
45
#define LONG_REPEAT_MASK    ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
46
#define LONG_REPEAT_SP_MASK ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
47
 
48
#define REPEAT_START    70  // after 700ms
49
#define REPEAT_NEXT     15  // every 150ms
50
#define REPEAT_SPEED_1  20  // every 200ms
51
#define REPEAT_SPEED_2   8  // every  80ms
52
#define REPEAT_SPEED_3   1  // every  10ms
53
 
54
#define ABO_TIMEOUT 300 // 3 sec
55
extern volatile uint8_t Display_on;
56
extern volatile uint16_t IdleTimer;
57
 
58
extern volatile uint16_t timer;
59
extern volatile uint16_t abo_timer;
60
extern uint16_t WarnCount;
61
 
62
 
63
//extern volatile unsigned int BeepTime;
64
extern unsigned int BeepTime;
65
extern unsigned int BeepMuster;
66
 
67
void Timer0_Init (void);  // Systeminterrupt
68
void Timer1_Init (void);  // Servotester
69
void Timer2_Init (void);  // Displayhelligkeit
70
 
71
uint8_t get_key_press (uint8_t key_mask);  // sofort beim drücken
72
uint8_t get_key_short (uint8_t key_mask);  // erst beim loslassen
73
uint8_t get_key_long (uint8_t key_mask);  // verzögert
74
uint8_t get_key_rpt (uint8_t key_mask);  // mit verzögerung
75
uint8_t get_key_long_rpt (uint8_t key_mask);  //
76
uint8_t get_key_long_rpt_sp (uint8_t key_mask, uint8_t key_speed);  // mit verzögerung und 3 versch. geschw.
77
 
78
extern volatile unsigned int CountMilliseconds;
79
 
80
 
81
void Delay_ms(unsigned int);
82
unsigned int SetDelay (unsigned int t);
83
char CheckDelay (unsigned int t);
84
void LipoCheck (void); // Lowbatpin des Spannungswandlers prüfen
85
 
86
 
87
#endif