From 37c93e432e6f5ee368b673953c0ef64e4abcc2f5 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 27 Oct 2015 14:53:28 +0100 Subject: ucoo/hal/timer: add TIM10 & TIM11 --- ucoo/hal/timer/timer.stm32.tcc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'ucoo') diff --git a/ucoo/hal/timer/timer.stm32.tcc b/ucoo/hal/timer/timer.stm32.tcc index ec76c4d..e031f8c 100644 --- a/ucoo/hal/timer/timer.stm32.tcc +++ b/ucoo/hal/timer/timer.stm32.tcc @@ -42,6 +42,7 @@ struct TimerHardware static const unsigned int max = 0xffff; static const bool advanced = true; static const bool slave = true; + static const bool one_pulse = true; static const int channels = 4; }; @@ -57,6 +58,7 @@ struct TimerHardware #endif static const bool advanced = false; static const bool slave = true; + static const bool one_pulse = true; static const int channels = 4; }; @@ -68,6 +70,7 @@ struct TimerHardware static const unsigned int max = 0xffff; static const bool advanced = false; static const bool slave = true; + static const bool one_pulse = true; static const int channels = 4; }; @@ -79,9 +82,34 @@ struct TimerHardware static const unsigned int max = 0xffff; static const bool advanced = false; static const bool slave = true; + static const bool one_pulse = true; static const int channels = 4; }; +template<> +struct TimerHardware +{ + static const enum rcc_periph_clken clken = RCC_TIM10; + static int freq () { return 2 * rcc_apb2_frequency; } + static const unsigned int max = 0xffff; + static const bool advanced = false; + static const bool slave = false; + static const bool one_pulse = false; + static const int channels = 1; +}; + +template<> +struct TimerHardware +{ + static const enum rcc_periph_clken clken = RCC_TIM10; + static int freq () { return 2 * rcc_apb2_frequency; } + static const unsigned int max = 0xffff; + static const bool advanced = false; + static const bool slave = false; + static const bool one_pulse = false; + static const int channels = 1; +}; + template const unsigned int TimerHard::max = TimerHardware::max; @@ -253,6 +281,7 @@ struct TimerHard::OptionReloadValue : public TimerHard::Option template struct TimerHard::OptionOnePulse : public TimerHard::Option { + static_assert (TimerHardware::one_pulse, "no one pulse mode"); static const unsigned cr1 = TIM_CR1_OPM; }; -- cgit v1.2.3