The unified diff between revisions [23a3e9a5..] and [be147b11..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'timer.h'
# # old_revision [23a3e9a50b4034343e3bd217d2c225dcaec064dd] # new_revision [be147b11caac304fda1579ac71017eecc3bb79e0] # # patch "timer.h" # from [c2e75d36a6314f29f490f12d9d98f4bb50b843fc] # to [a1df137b32f7a24a94d0b016cb360bc10529bfa8] # ============================================================ --- timer.h c2e75d36a6314f29f490f12d9d98f4bb50b843fc +++ timer.h a1df137b32f7a24a94d0b016cb360bc10529bfa8 @@ -1,6 +1,8 @@ #ifndef __TIMER_H #define __TIMER_H +#include "types.h" + #define TIMER_PCLK 14745600 #define TIMER_PRESCALE 0 @@ -8,12 +10,30 @@ #define TIMER_MS (TIMER_SECOND/1000) #define TIMER_US (TIMER_SECOND/1000000) +#define PWM_MAX 14745 +#if 0 +#define PWM_PERIOD 58980 +#endif +#define PWM_PERIOD ((4*PWM_MAX)+1) + +#define TIMER_INPUT_TIMEOUT (TIMER_PCLK/10) + +#define TIMER_CH(x) (timer_map[x]) + +extern volatile unsigned int timer1_width[]; +extern unsigned int timer_map[]; + void init_timer(void); unsigned int timer_read(void); void timer_delay_clocks(unsigned int clocks); void timer_set_period(unsigned int period); +void timer_set_pwm_value(int channel, int value); +void timer_set_pwm_invalid(int channel); +bool timer_valid(int channel); +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) +#define timer_input(ch) (timer1_width[TIMER_CH(ch)]) #endif /* __TIMER_H */