The unified diff between revisions [4f22e7ef..] and [08a35a66..] 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 [4f22e7ef7d3064e3b51a5b868a4722f3f13c747b] # new_revision [08a35a6680cdf8985cfb16fa6779ee6db7202a9c] # # patch "timer.h" # from [35eaca1c3fe810fd864583e55e91ab518ea25bd5] # to [77f91cb86b26421f2d28236d25d384e9a025e939] # ============================================================ --- timer.h 35eaca1c3fe810fd864583e55e91ab518ea25bd5 +++ timer.h 77f91cb86b26421f2d28236d25d384e9a025e939 @@ -3,13 +3,14 @@ #include "types.h" -#define TIMER_PCLK 14745600 -#define TIMER_PRESCALE 9215 -#define TIMER0_PRESCALE 0 +#define TIMER_PCLK 58982400 +#define TIMER_PRESCALE 36863 +#define TIMER0_PRESCALE 3 #define TIMER_SECOND (TIMER_PCLK/(TIMER_PRESCALE+1)) -#define TIMER_MS (TIMER_SECOND/1000) -#define TIMER_US (TIMER_SECOND/1000000) +/* Since we're using awkward numbers, this gives better accuracy */ +#define TIMER_MS(x) ((x) * TIMER_SECOND / 1000) +#define TIMER_US(x) ((x) * TIMER_SECOND / 1000000) #define TIMER0_SECOND (TIMER_PCLK/(TIMER0_PRESCALE+1)) #define TIMER0_MS (TIMER0_SECOND/1000) @@ -21,7 +22,7 @@ #endif #define PWM_PERIOD ((4*PWM_MAX)+1) -#define TIMER_INPUT_TIMEOUT (TIMER_PCLK/10) +#define TIMER_INPUT_TIMEOUT (TIMER0_SECOND/10) #define TIMER_CPPM_SYNC 40000 #define TIMER_CH(x) (timer_map[x])