Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1469 → Rev 1470

/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/timer.h
0,0 → 1,87
/*****************************************************************************
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de *
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net *
* based on the key handling by Peter Dannegger *
* see www.mikrocontroller.net *
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net *
* Copyright (C) 2011 Harald Bongartz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
* *
* Credits to: *
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN *
* http://www.mikrokopter.de *
* Gregor "killagreg" Stobrawa for his version of the MK code *
* Thomas Kaiser "thkais" for the original project. See *
* http://www.ft-fanpage.de/mikrokopter/ *
* http://forum.mikrokopter.de/topic-4061-1.html *
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code *
* http://www.mylifesucks.de/oss/c-osd/ *
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility*
*****************************************************************************/
 
#ifndef _TIMER_H
#define _TIMER_H
 
#include "cpu.h"
#include "main.h"
 
#define KEY_ALL ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
#define LONG_MASK ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
#define REPEAT_MASK ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
#define LONG_REPEAT_MASK ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
#define LONG_REPEAT_SP_MASK ((1 << KEY_PLUS) | (1 << KEY_MINUS) | (1 << KEY_ENTER) | (1 << KEY_ESC))
 
#define REPEAT_START 70 // after 700ms
#define REPEAT_NEXT 15 // every 150ms
#define REPEAT_SPEED_1 20 // every 200ms
#define REPEAT_SPEED_2 8 // every 80ms
#define REPEAT_SPEED_3 1 // every 10ms
 
#define ABO_TIMEOUT 300 // 3 sec
extern volatile uint8_t Display_on;
extern volatile uint16_t IdleTimer;
 
extern volatile uint16_t timer;
extern volatile uint16_t abo_timer;
extern uint16_t WarnCount;
 
 
//extern volatile unsigned int BeepTime;
extern unsigned int BeepTime;
extern unsigned int BeepMuster;
 
void Timer0_Init (void); // Systeminterrupt
void Timer1_Init (void); // Servotester
void Timer2_Init (void); // Displayhelligkeit
 
uint8_t get_key_press (uint8_t key_mask); // sofort beim drücken
uint8_t get_key_short (uint8_t key_mask); // erst beim loslassen
uint8_t get_key_long (uint8_t key_mask); // verzögert
uint8_t get_key_rpt (uint8_t key_mask); // mit verzögerung
uint8_t get_key_long_rpt (uint8_t key_mask); //
uint8_t get_key_long_rpt_sp (uint8_t key_mask, uint8_t key_speed); // mit verzögerung und 3 versch. geschw.
 
extern volatile unsigned int CountMilliseconds;
 
 
void Delay_ms(unsigned int);
unsigned int SetDelay (unsigned int t);
char CheckDelay (unsigned int t);
void LipoCheck (void); // Lowbatpin des Spannungswandlers prüfen
 
 
#endif