Added set prescaler and set repetition counter functions to timer.

This commit is contained in:
Piotr Esden-Tempski
2011-01-31 22:08:37 -08:00
parent 92edc113f9
commit d40fb96fcf
3 changed files with 21 additions and 3 deletions

View File

@@ -124,9 +124,6 @@ void tim_setup(void)
/* Reset TIM1 peripheral */
timer_reset(TIM1);
/* Clock division. */
timer_set_clock_division(TIM1, TIM_CR1_CKD_CK_INT);
/* Timer global mode:
* - No divider
* - alignment edge
@@ -136,6 +133,12 @@ void tim_setup(void)
TIM_CR1_CMS_EDGE,
TIM_CR1_DIR_UP);
/* Reset prescaler value. */
timer_set_prescaler(TIM1, 0);
/* Reset repetition counter value. */
timer_set_repetition_counter(TIM1, 0);
/* Enable preload. */
timer_enable_preload(TIM1);