Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1734 - 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 BeepNormal      0       // Normal Beep
55
#define BeepSevere      1       // schwerer Fehler, Beep nicht unterbrechbar
56
#define BeepOff         2       // Beep aus
57
 
58
#define ABO_TIMEOUT 300 // 3 sec
59
extern volatile uint8_t Display_on;
60
extern volatile uint16_t IdleTimer;
61
 
62
extern volatile uint16_t timer;
63
extern volatile uint16_t abo_timer;
64
extern uint16_t WarnCount;
65
 
66
 
67
 
68
 
69
//extern volatile unsigned int BeepTime;
70
extern unsigned int BeepTime;
71
extern unsigned int BeepMuster;
72
 
73
void Timer0_Init (void);  // Systeminterrupt
74
void Timer1_Init (void);  // Servotester
75
void Timer2_Init (void);  // Displayhelligkeit
76
 
77
uint8_t get_key_press (uint8_t key_mask);  // sofort beim drücken
78
uint8_t get_key_short (uint8_t key_mask);  // erst beim loslassen
79
uint8_t get_key_long (uint8_t key_mask);  // verzögert
80
uint8_t get_key_rpt (uint8_t key_mask);  // mit verzögerung
81
uint8_t get_key_long_rpt (uint8_t key_mask);  //
82
uint8_t get_key_long_rpt_sp (uint8_t key_mask, uint8_t key_speed);  // mit verzögerung und 3 versch. geschw.
83
void set_beep ( uint16_t Time, uint16_t Muster, uint8_t Prio);
84
extern volatile unsigned int CountMilliseconds;
85
 
86
 
87
void Delay_ms(unsigned int);
88
unsigned int SetDelay (unsigned int t);
89
char CheckDelay (unsigned int t);
90
void LipoCheck (void); // Lowbatpin des Spannungswandlers prüfen
91
 
92
 
93
#endif