diff options
Diffstat (limited to 'os/hal/ports/STM32/LLD/TIMv1/hal_icu_lld.c')
-rw-r--r-- | os/hal/ports/STM32/LLD/TIMv1/hal_icu_lld.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/os/hal/ports/STM32/LLD/TIMv1/hal_icu_lld.c b/os/hal/ports/STM32/LLD/TIMv1/hal_icu_lld.c index cbd7cee57..38ac673ab 100644 --- a/os/hal/ports/STM32/LLD/TIMv1/hal_icu_lld.c +++ b/os/hal/ports/STM32/LLD/TIMv1/hal_icu_lld.c @@ -94,6 +94,14 @@ ICUDriver ICUD8; ICUDriver ICUD9;
#endif
+/**
+ * @brief ICUD15 driver identifier.
+ * @note The driver ICUD15 allocates the timer TIM15 when enabled.
+ */
+#if STM32_ICU_USE_TIM15 || defined(__DOXYGEN__)
+ICUDriver ICUD15;
+#endif
+
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
@@ -323,6 +331,12 @@ OSAL_IRQ_HANDLER(STM32_TIM9_HANDLER) { #endif /* !defined(STM32_TIM9_SUPPRESS_ISR) */
#endif /* STM32_ICU_USE_TIM9 */
+#if STM32_ICU_USE_TIM15 || defined(__DOXYGEN__)
+#if !defined(STM32_TIM15_SUPPRESS_ISR)
+#error "TIM15 ISR not defined by platform"
+#endif /* !defined(STM32_TIM15_SUPPRESS_ISR) */
+#endif /* STM32_ICU_USE_TIM15 */
+
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
@@ -375,6 +389,12 @@ void icu_lld_init(void) { icuObjectInit(&ICUD9);
ICUD9.tim = STM32_TIM9;
#endif
+
+#if STM32_ICU_USE_TIM15
+ /* Driver initialization.*/
+ icuObjectInit(&ICUD15);
+ ICUD15.tim = STM32_TIM15;
+#endif
}
/**
@@ -499,6 +519,18 @@ void icu_lld_start(ICUDriver *icup) { #endif
}
#endif
+
+#if STM32_ICU_USE_TIM15
+ if (&ICUD15 == icup) {
+ rccEnableTIM15(true);
+ rccResetTIM15();
+#if defined(STM32_TIM15CLK)
+ icup->clock = STM32_TIM15CLK;
+#else
+ icup->clock = STM32_TIMCLK2;
+#endif
+ }
+#endif
}
else {
/* Driver re-configuration scenario, it must be stopped first.*/
@@ -650,6 +682,12 @@ void icu_lld_stop(ICUDriver *icup) { rccDisableTIM9();
}
#endif
+
+#if STM32_ICU_USE_TIM15
+ if (&ICUD15 == icup) {
+ rccDisableTIM15();
+ }
+#endif
}
}
|