From e75668f53b3347044e5029d296ee6a7915627063 Mon Sep 17 00:00:00 2001 From: barthess Date: Tue, 3 Mar 2015 22:43:25 +0300 Subject: EICU. Cosmetical cleanup --- os/hal/ports/STM32/LLD/eicu_lld.c | 27 +++++++++++++++++++++++---- os/hal/ports/STM32/LLD/eicu_lld.h | 22 +++++++++++++++++----- 2 files changed, 40 insertions(+), 9 deletions(-) (limited to 'os/hal/ports') diff --git a/os/hal/ports/STM32/LLD/eicu_lld.c b/os/hal/ports/STM32/LLD/eicu_lld.c index 9b901f9..0245128 100644 --- a/os/hal/ports/STM32/LLD/eicu_lld.c +++ b/os/hal/ports/STM32/LLD/eicu_lld.c @@ -128,11 +128,12 @@ EICUDriver EICUD12; /* Driver local functions. */ /*===========================================================================*/ /** - * @brief Returns the time between latest 2 capture events. + * @brief Returns both pulse width and period. * @details The time is defined as number of ticks. * * @param[in] eicup Pointer to the EICUDriver object. * @param[in] channel The timer channel that fired the interrupt. + * @param[in] compare Content of the CCR register. * @return The number of ticks. * * @notapi @@ -172,7 +173,15 @@ static eicuresult_t get_time_both(EICUDriver *eicup, } /** + * @brief Returns pulse width. + * @details The time is defined as number of ticks. * + * @param[in] eicup Pointer to the EICUDriver object. + * @param[in] channel The timer channel that fired the interrupt. + * @param[in] compare Content of the CCR register. + * @return The number of ticks. + * + * @notapi */ static eicucnt_t get_time_width(EICUDriver *eicup, eicuchannel_t channel, @@ -202,7 +211,15 @@ static eicucnt_t get_time_width(EICUDriver *eicup, } /** + * @brief Returns both pulse period. + * @details The time is defined as number of ticks. * + * @param[in] eicup Pointer to the EICUDriver object. + * @param[in] channel The timer channel that fired the interrupt. + * @param[in] compare Content of the CCR register. + * @return The number of ticks. + * + * @notapi */ static eicucnt_t get_time_period(EICUDriver *eicup, eicuchannel_t channel, @@ -285,7 +302,7 @@ static void isr_invoke_edge_cb(EICUDriver *eicup, eicuchannel_t channel) { } /** - * @brief Common ISR call. + * @brief Common EICU detect call. * * @param[in] eicup Pointer to the @p EICUDriver object * @param[in] channel The timer channel that fired the interrupt. @@ -327,9 +344,11 @@ static void eicu_lld_serve_interrupt(EICUDriver *eicup) { } /** + * @brief Starts every channel. * + * @param[in] eicup Pointer to the @p EICUDriver object */ -static void eicu_channels_start(EICUDriver *eicup) { +static void start_channels(EICUDriver *eicup) { /* Set each input channel that is used as: a normal input capture channel, link the corresponding CCR register and set polarity. */ @@ -827,7 +846,7 @@ void eicu_lld_start(EICUDriver *eicup) { } #endif - eicu_channels_start(eicup); + start_channels(eicup); } /** diff --git a/os/hal/ports/STM32/LLD/eicu_lld.h b/os/hal/ports/STM32/LLD/eicu_lld.h index 5c6c3fa..4f10893 100644 --- a/os/hal/ports/STM32/LLD/eicu_lld.h +++ b/os/hal/ports/STM32/LLD/eicu_lld.h @@ -256,17 +256,29 @@ * @brief Active level selector. */ typedef enum { - EICU_INPUT_ACTIVE_HIGH = 0, /**< Trigger on rising edge. */ - EICU_INPUT_ACTIVE_LOW = 1, /**< Trigger on falling edge. */ + EICU_INPUT_ACTIVE_HIGH, /**< Trigger on rising edge. */ + EICU_INPUT_ACTIVE_LOW, /**< Trigger on falling edge. */ } eicuactivelevel_t; /** * @brief Input type selector. */ typedef enum { - EICU_INPUT_EDGE = 0, /**< Measures time between consequent edges.*/ - EICU_INPUT_PULSE = 1, /**< Measures pulse width.*/ - EICU_INPUT_BOTH = 2 /**< Measures both period and width. */ + /** + * @brief Measures time between consequent edges. + * @details Callback fires on every _active_ edge. + */ + EICU_INPUT_EDGE, + /** + * @brief Measures pulse width. + * @details Callback fires on _idle_ edge of pulse. + */ + EICU_INPUT_PULSE, + /** + * @brief Measures both period and width.. + * @details Callback fires on _active_ edge of pulse. + */ + EICU_INPUT_BOTH } eicucapturemode_t; /** -- cgit v1.2.3