summaryrefslogtreecommitdiff
path: root/ucoo
diff options
context:
space:
mode:
authorNicolas Schodet2015-10-27 14:53:28 +0100
committerNicolas Schodet2019-10-07 00:44:57 +0200
commit37c93e432e6f5ee368b673953c0ef64e4abcc2f5 (patch)
tree89b4c030fecae7fc5380d5c5343e85b14ef1e678 /ucoo
parent00f3718f1d52cfb3c8fd10e4c454d7486427a4a1 (diff)
ucoo/hal/timer: add TIM10 & TIM11
Diffstat (limited to 'ucoo')
-rw-r--r--ucoo/hal/timer/timer.stm32.tcc29
1 files changed, 29 insertions, 0 deletions
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<TIM1>
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<TIM2>
#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<TIM3>
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<TIM4>
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<TIM10>
+{
+ 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<TIM11>
+{
+ 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<uint32_t Base>
const unsigned int TimerHard<Base>::max = TimerHardware<Base>::max;
@@ -253,6 +281,7 @@ struct TimerHard<Base>::OptionReloadValue : public TimerHard<Base>::Option
template<uint32_t Base>
struct TimerHard<Base>::OptionOnePulse : public TimerHard<Base>::Option
{
+ static_assert (TimerHardware<Base>::one_pulse, "no one pulse mode");
static const unsigned cr1 = TIM_CR1_OPM;
};