From d40fb96fcf6b7415c445df036641ebd1fa00e55c Mon Sep 17 00:00:00 2001 From: Piotr Esden-Tempski Date: Mon, 31 Jan 2011 22:08:37 -0800 Subject: Added set prescaler and set repetition counter functions to timer. --- lib/stm32/timer.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/stm32/timer.c b/lib/stm32/timer.c index 9a6534d..827cde0 100644 --- a/lib/stm32/timer.c +++ b/lib/stm32/timer.c @@ -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; -- cgit v1.2.3