aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPiotr Esden-Tempski2011-01-31 22:08:37 -0800
committerPiotr Esden-Tempski2011-01-31 22:08:37 -0800
commitd40fb96fcf6b7415c445df036641ebd1fa00e55c (patch)
tree203e0a4f2c39022059a23925c5bfa8b6a79394f5 /lib
parent92edc113f9825f333ea66e41e8fcdbeb45da9cd6 (diff)
Added set prescaler and set repetition counter functions to timer.
Diffstat (limited to 'lib')
-rw-r--r--lib/stm32/timer.c13
1 files changed, 13 insertions, 0 deletions
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;