Implement CPPM reception. Keep it as an option for now.

Recalibrate the radio, as the timings have changed.
And, it seems a couple of channels are now swapped with the new radio. Or
rather, unswapped. So fix the channel map to match.
This commit is contained in:
2013-04-07 01:39:36 +00:00
parent 2fa58944fa
commit b9c08d88b1
4 changed files with 52 additions and 18 deletions

View File

@@ -17,10 +17,12 @@
#define PWM_PERIOD ((4*PWM_MAX)+1)
#define TIMER_INPUT_TIMEOUT (TIMER_PCLK/10)
#define TIMER_CPPM_SYNC 40000
#define TIMER_CH(x) (timer_map[x])
extern volatile unsigned int timer1_width[];
extern volatile unsigned int timer1_cppm[];
extern unsigned int timer_map[];
void init_timer(void);
@@ -35,5 +37,9 @@ bool timer_allvalid(void);
#define timer_delay_us(x) timer_delay_clocks((x)*TIMER_US)
#define timer_delay_ms(x) timer_delay_clocks((x)*TIMER_MS)
#ifdef TIMER_CPPM
#define timer_input(ch) (timer1_cppm[TIMER_CH(ch)])
#else
#define timer_input(ch) (timer1_width[TIMER_CH(ch)])
#endif
#endif /* __TIMER_H */