Subversion Repositories FlightCtrl

Rev

Rev 2099 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1910 - 1
#ifndef _TIMER0_H
2
#define _TIMER0_H
3
 
4
#include <inttypes.h>
5
 
2099 - 6
// Normally it is 20MHz/2048 = 9765.625 Hz
7
#define F_TIMER0IRQ ((float)F_CPU/2048.0)
8
#define MAINLOOP_DIVIDER 10
9
// Originally it is 488
10
#define F_MAINLOOP (F_TIMER0IRQ/(2.0*MAINLOOP_DIVIDER))
11
 
12
#define BEEP_MODULATION_NONE 0xFFFF
13
#define BEEP_MODULATION_RCALARM 0x0C00
14
#define BEEP_MODULATION_I2CALARM 0x0080
15
#define BEEP_MODULATION_BATTERYALARM 0x0300
16
#define BEEP_MODULATION_EEPROMALARM 0x0007
17
 
18
extern volatile uint32_t globalMillisClock;
1910 - 19
extern volatile uint8_t  runFlightControl;
20
extern volatile uint16_t beepModulation;
21
extern volatile uint16_t beepTime;
22
#ifdef USE_NAVICTRL
23
extern volatile uint8_t SendSPI;
24
#endif
25
 
2124 - 26
void timer0_init(void);
27
void delay_ms(uint16_t w);
28
void delay_ms_with_adc_measurement(uint16_t w, uint8_t stop);
29
uint16_t setDelay(uint16_t t);
30
int8_t checkDelay(uint16_t t);
1910 - 31
 
2124 - 32
#ifdef DO_PROFILE
33
#define NUM_PROFILE_TIMERS 4
34
#define ATTITUDE 0
35
#define CONTROLMIXER 1
36
#define COMMANDS 2
37
#define FLIGHT 3
38
 
39
void startProfileTimer(uint8_t timer);
40
void stopProfileTimer(uint8_t timer);
41
void debugProfileTimers(uint8_t index);
42
#endif
43
 
1910 - 44
#endif //_TIMER0_H