From ab62929a0a7e3dfd5f095c8182425829a8d1b2a6 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 8 Dec 2015 15:54:19 +0100 Subject: ucoo/hal/timer: enable/disable update interrupt This should be improved to handle low level interrupt access. --- ucoo/hal/timer/timer.stm32.hh | 4 ++++ ucoo/hal/timer/timer.stm32.tcc | 14 ++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'ucoo') diff --git a/ucoo/hal/timer/timer.stm32.hh b/ucoo/hal/timer/timer.stm32.hh index a7d135d..f139fce 100644 --- a/ucoo/hal/timer/timer.stm32.hh +++ b/ucoo/hal/timer/timer.stm32.hh @@ -58,6 +58,10 @@ class TimerHard void wait_input_capture (int ch) const; /// Get timer frequency. int get_freq () const { return freq_; } + /// Enable interrupts on update event. + void enable_interrupt (); + /// Disable interrupts on update event. + void disable_interrupt (); private: /// Enable updates (reload value, output compare values...). void enable_updates (); diff --git a/ucoo/hal/timer/timer.stm32.tcc b/ucoo/hal/timer/timer.stm32.tcc index e031f8c..4083f26 100644 --- a/ucoo/hal/timer/timer.stm32.tcc +++ b/ucoo/hal/timer/timer.stm32.tcc @@ -227,6 +227,20 @@ TimerHard::wait_input_capture (int ch) const TIM_SR (Base) = ~mask; } +template +void +TimerHard::enable_interrupt () +{ + TIM_DIER (Base) |= TIM_DIER_UIE; +} + +template +void +TimerHard::disable_interrupt () +{ + TIM_DIER (Base) &= ~TIM_DIER_UIE; +} + template void TimerHard::enable_updates () -- cgit v1.2.3