Replaced OC mode selection with an enum, makes it simpler to use.

This commit is contained in:
Piotr Esden-Tempski
2011-01-28 15:11:52 -08:00
parent 5975750e5e
commit a1bd228c87
3 changed files with 122 additions and 10 deletions

View File

@@ -104,7 +104,7 @@ void tim_setup(void)
timer_disable_oc_clear(TIM1, TIM_OC1);
timer_enable_oc_preload(TIM1, TIM_OC1);
timer_set_oc_slow_mode(TIM1, TIM_OC1);
timer_set_oc_mode(TIM1, TIM_OC1, TIM_CCMR1_OC1M_PWM1);
timer_set_oc_mode(TIM1, TIM_OC1, TIM_OCM_PWM1);
/* Configure OC1. */
timer_set_oc_polarity_high(TIM1, TIM_OC1);
@@ -131,7 +131,7 @@ void tim_setup(void)
timer_disable_oc_clear(TIM1, TIM_OC2);
timer_enable_oc_preload(TIM1, TIM_OC2);
timer_set_oc_slow_mode(TIM1, TIM_OC2);
timer_set_oc_mode(TIM1, TIM_OC2, TIM_CCMR1_OC2M_PWM1);
timer_set_oc_mode(TIM1, TIM_OC2, TIM_OCM_PWM1);
/* Configure OC2. */
timer_set_oc_polarity_high(TIM1, TIM_OC2);
@@ -158,7 +158,7 @@ void tim_setup(void)
timer_disable_oc_clear(TIM1, TIM_OC3);
timer_enable_oc_preload(TIM1, TIM_OC3);
timer_set_oc_slow_mode(TIM1, TIM_OC3);
timer_set_oc_mode(TIM1, TIM_OC3, TIM_CCMR2_OC3M_PWM1);
timer_set_oc_mode(TIM1, TIM_OC3, TIM_OCM_PWM1);
/* Configure OC3. */
timer_set_oc_polarity_high(TIM1, TIM_OC3);