Rev 2060 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1612 | dongfang | 1 | #ifndef _TIMER0_H |
2 | #define _TIMER0_H |
||
3 | |||
4 | #include <inttypes.h> |
||
5 | |||
2052 | - | 6 | // Normally it is 20MHz/2048 = 9765.625 Hz |
7 | #define F_TIMER0IRQ ((float)F_CPU/2048.0) |
||
2189 | - | 8 | #define T_TIMER0IRQ ((float)2048.0/(float)F_CPU) |
9 | // About 250 Hz |
||
10 | #define F_CONTROL 250 |
||
11 | #define CONTROLLOOP_DIVIDER (F_TIMER0IRQ/F_CONTROL) |
||
12 | #define SERIALLOOP_DIVIDER 61 |
||
13 | #define OUTPUTLOOP_DIVIDER 100 |
||
2052 | - | 14 | |
2189 | - | 15 | extern volatile uint32_t jiffiesClock; |
16 | extern volatile uint32_t millisClock; |
||
17 | extern volatile uint8_t loopJiffiesClock; |
||
1908 | - | 18 | |
1612 | dongfang | 19 | extern void timer0_init(void); |
1887 | - | 20 | extern void delay_ms(uint16_t w); |
21 | extern uint16_t setDelay(uint16_t t); |
||
22 | extern int8_t checkDelay(uint16_t t); |
||
1612 | dongfang | 23 | |
2189 | - | 24 | typedef enum { |
25 | NOT_RUNNING = 0, |
||
26 | RUNNING, |
||
27 | BLOCKED_FOR_CALIBRATION |
||
28 | } FlightControlRunStatus; |
||
29 | |||
30 | extern volatile uint8_t flightControlStatus; |
||
31 | |||
1612 | dongfang | 32 | #endif //_TIMER0_H |