Improved icuWaitCapture().
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7212 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
6c97d4f6fb
commit
5f454cad47
|
@ -93,7 +93,7 @@ typedef void (*icucallback_t)(ICUDriver *icup);
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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
|
* @details The function waits for the next PWM input activation front then
|
||||||
* brings the driver in the @p ICU_ACTIVE state.
|
* brings the driver in the @p ICU_ACTIVE state.
|
||||||
* @note If notifications are enabled then the transition to the
|
* @note If notifications are enabled then the transition to the
|
||||||
|
|
|
@ -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
|
* @details The function waits for the next PWM input activation front then
|
||||||
* brings the driver in the @p ICU_ACTIVE state.
|
* brings the driver in the @p ICU_ACTIVE state.
|
||||||
* @note If notifications are enabled then the transition to the
|
* @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) {
|
void icu_lld_wait_capture(ICUDriver *icup) {
|
||||||
|
|
||||||
if (icup->config->channel == ICU_CHANNEL_1) {
|
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)
|
while ((icup->tim->SR & STM32_TIM_SR_CC1IF) == 0)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/* Resetting capture flag.*/
|
||||||
|
icup->tim->SR &= ~STM32_TIM_SR_CC2IF;
|
||||||
|
|
||||||
|
/* Waiting for an edge.*/
|
||||||
while ((icup->tim->SR & STM32_TIM_SR_CC2IF) == 0)
|
while ((icup->tim->SR & STM32_TIM_SR_CC2IF) == 0)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ void icuStartCapture(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
|
* @details The function waits for the next PWM input activation front then
|
||||||
* brings the driver in the @p ICU_ACTIVE state.
|
* brings the driver in the @p ICU_ACTIVE state.
|
||||||
* @note If notifications are enabled then the transition to the
|
* @note If notifications are enabled then the transition to the
|
||||||
|
@ -148,7 +148,8 @@ void icuWaitCapture(ICUDriver *icup) {
|
||||||
osalDbgCheck(icup != NULL);
|
osalDbgCheck(icup != NULL);
|
||||||
|
|
||||||
osalSysLock();
|
osalSysLock();
|
||||||
osalDbgAssert(icup->state == ICU_WAITING, "invalid state");
|
osalDbgAssert((icup->state == ICU_WAITING) || (icup->state == ICU_ACTIVE),
|
||||||
|
"invalid state");
|
||||||
icuWaitCaptureI(icup);
|
icuWaitCaptureI(icup);
|
||||||
osalSysUnlock();
|
osalSysUnlock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue