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

@@ -253,6 +253,19 @@ void timer_disable_preload_complementry_enable_bits(u32 timer_peripheral)
TIM_CR2(timer_peripheral) &= ~TIM_CR2_CCPC;
}
void timer_set_prescaler(u32 timer_peripheral, u32 value)
{
TIM_PSC(timer_peripheral) = value;
}
void timer_set_repetition_counter(u32 timer_peripheral, u32 value)
{
if ((timer_peripheral == TIM1) ||
(timer_peripheral == TIM8)) {
TIM_RCR(timer_peripheral) = value;
}
}
void timer_set_period(u32 timer_peripheral, u32 period)
{
TIM_ARR(timer_peripheral) = period;