aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/icu_lld.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-04-01 08:45:34 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-04-01 08:45:34 +0000
commit0b0fb6f88f6851842e89f19129b0dc535f41dcbc (patch)
tree68f624b27371ca455ea1e43e16074963fd66d495 /os/hal/platforms/STM32/icu_lld.c
parentbeab954a35b7c6be13b8c5af58c7cd52b5888abc (diff)
downloadChibiOS-0b0fb6f88f6851842e89f19129b0dc535f41dcbc.tar.gz
ChibiOS-0b0fb6f88f6851842e89f19129b0dc535f41dcbc.tar.bz2
ChibiOS-0b0fb6f88f6851842e89f19129b0dc535f41dcbc.zip
ICU driver functional.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2857 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/icu_lld.c')
-rw-r--r--os/hal/platforms/STM32/icu_lld.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/os/hal/platforms/STM32/icu_lld.c b/os/hal/platforms/STM32/icu_lld.c
index 5d3bb284d..f950a5eb6 100644
--- a/os/hal/platforms/STM32/icu_lld.c
+++ b/os/hal/platforms/STM32/icu_lld.c
@@ -91,12 +91,18 @@ ICUDriver ICUD5;
static void icu_lld_serve_interrupt(ICUDriver *icup) {
uint16_t sr;
- sr = TIM1->SR & TIM1->DIER;
+ sr = icup->tim->SR & icup->tim->DIER;
icup->tim->SR = 0;
- if ((sr & TIM_SR_CC1IF) != 0)
- icup->config->period_cb(icup);
- if ((sr & TIM_SR_CC2IF) != 0)
+ if ((sr & TIM_SR_CC1IF) != 0) {
+ icustate_t previous_state = icup->state;
+ icup->state = ICU_ACTIVE;
+ if (previous_state != ICU_WAITING)
+ icup->config->period_cb(icup);
+ }
+ if ((sr & TIM_SR_CC2IF) != 0) {
+ icup->state = ICU_IDLE;
icup->config->width_cb(icup);
+ }
}
/*===========================================================================*/