diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-08-31 17:32:29 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-08-31 17:32:29 +0000 |
commit | 5f454cad47e60e5562b092bb64aec334a375cdb9 (patch) | |
tree | 8b5e456b4c1fa38f778389b0d20a3f2b5d337f1a /os/hal/ports/STM32 | |
parent | 6c97d4f6fb4184c41f6283ce025a7030280a1802 (diff) | |
download | ChibiOS-5f454cad47e60e5562b092bb64aec334a375cdb9.tar.gz ChibiOS-5f454cad47e60e5562b092bb64aec334a375cdb9.tar.bz2 ChibiOS-5f454cad47e60e5562b092bb64aec334a375cdb9.zip |
Improved icuWaitCapture().
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7212 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/STM32')
-rw-r--r-- | os/hal/ports/STM32/LLD/TIMv1/icu_lld.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/os/hal/ports/STM32/LLD/TIMv1/icu_lld.c b/os/hal/ports/STM32/LLD/TIMv1/icu_lld.c index 6ee7ff293..d8bc2e84c 100644 --- a/os/hal/ports/STM32/LLD/TIMv1/icu_lld.c +++ b/os/hal/ports/STM32/LLD/TIMv1/icu_lld.c @@ -615,7 +615,7 @@ void icu_lld_start_capture(ICUDriver *icup) { }
/**
- * @brief Waits for the first cycle activation edge.
+ * @brief Waits for the next cycle activation edge.
* @details The function waits for the next PWM input activation front then
* brings the driver in the @p ICU_ACTIVE state.
* @note If notifications are enabled then the transition to the
@@ -629,10 +629,18 @@ void icu_lld_start_capture(ICUDriver *icup) { void icu_lld_wait_capture(ICUDriver *icup) {
if (icup->config->channel == ICU_CHANNEL_1) {
+ /* Resetting capture flag.*/
+ icup->tim->SR &= ~STM32_TIM_SR_CC1IF;
+
+ /* Waiting for an edge.*/
while ((icup->tim->SR & STM32_TIM_SR_CC1IF) == 0)
;
}
else {
+ /* Resetting capture flag.*/
+ icup->tim->SR &= ~STM32_TIM_SR_CC2IF;
+
+ /* Waiting for an edge.*/
while ((icup->tim->SR & STM32_TIM_SR_CC2IF) == 0)
;
}
|