From a708e083e1cf6f6181bcd02baf9cc580f38b5397 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 17 Oct 2014 07:31:40 +0000 Subject: Improvements to the ICU driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7409 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/TIMv1/icu_lld.c | 8 ++++---- os/hal/ports/STM32/LLD/TIMv1/icu_lld.h | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'os/hal/ports/STM32') diff --git a/os/hal/ports/STM32/LLD/TIMv1/icu_lld.c b/os/hal/ports/STM32/LLD/TIMv1/icu_lld.c index a9b949a7f..d5604515e 100644 --- a/os/hal/ports/STM32/LLD/TIMv1/icu_lld.c +++ b/os/hal/ports/STM32/LLD/TIMv1/icu_lld.c @@ -644,8 +644,8 @@ void icu_lld_start_capture(ICUDriver *icup) { /** * @brief Waits for a completed capture. - * @note The wait is performed in polled mode. - * @note The function cannot work if notifications are enabled. + * @note The operation is performed in polled mode. + * @note In order to use this function notifications must be disabled. * * @param[in] icup pointer to the @p ICUDriver object * @@ -687,7 +687,7 @@ void icu_lld_stop_capture(ICUDriver *icup) { * * @api */ -void icu_enable_notifications(ICUDriver *icup) { +void icu_lld_enable_notifications(ICUDriver *icup) { uint32_t dier = icup->tim->DIER; /* If interrupts were already enabled then the operation is skipped. @@ -733,7 +733,7 @@ void icu_enable_notifications(ICUDriver *icup) { * * @api */ -void icu_disable_notifications(ICUDriver *icup) { +void icu_lld_disable_notifications(ICUDriver *icup) { /* All interrupts disabled.*/ icup->tim->DIER &= ~STM32_TIM_DIER_IRQ_MASK; diff --git a/os/hal/ports/STM32/LLD/TIMv1/icu_lld.h b/os/hal/ports/STM32/LLD/TIMv1/icu_lld.h index eb50e69d2..5b8b71d9f 100644 --- a/os/hal/ports/STM32/LLD/TIMv1/icu_lld.h +++ b/os/hal/ports/STM32/LLD/TIMv1/icu_lld.h @@ -361,6 +361,19 @@ struct ICUDriver { */ #define icu_lld_get_period(icup) (*((icup)->pccrp) + 1) +/** + * @brief Check on notifications status. + * + * @param[in] icup pointer to the @p ICUDriver object + * @return The notifications status. + * @retval false if notifications are not enabled. + * @retval true if notifications are enabled. + * + * @notapi + */ +#define icu_lld_are_notifications_enabled(icup) \ + (bool)(((icup)->tim->DIER & STM32_TIM_DIER_IRQ_MASK) != 0) + /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ @@ -402,8 +415,8 @@ extern "C" { void icu_lld_start_capture(ICUDriver *icup); void icu_lld_wait_capture(ICUDriver *icup); void icu_lld_stop_capture(ICUDriver *icup); - void icu_enable_notifications(ICUDriver *icup); - void icu_disable_notifications(ICUDriver *icup); + void icu_lld_enable_notifications(ICUDriver *icup); + void icu_lld_disable_notifications(ICUDriver *icup); #ifdef __cplusplus } #endif -- cgit v1.2.3