From 781b0b129cccbecba160effce8c4ddd68295b8b9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 11 Sep 2010 10:57:11 +0000 Subject: Fixed bug 3064204. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2175 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/adc.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'os/hal/src') diff --git a/os/hal/src/adc.c b/os/hal/src/adc.c index 23b096f3e..df8b05fd5 100644 --- a/os/hal/src/adc.c +++ b/os/hal/src/adc.c @@ -67,7 +67,9 @@ void adcObjectInit(ADCDriver *adcp) { adcp->ad_samples = NULL; adcp->ad_depth = 0; adcp->ad_grpp = NULL; +#if ADC_USE_WAIT chSemInit(&adcp->ad_sem, 0); +#endif } /** @@ -229,8 +231,10 @@ void adcStopConversion(ADCDriver *adcp) { adc_lld_stop_conversion(adcp); adcp->ad_grpp = NULL; adcp->ad_state = ADC_READY; +#if ADC_USE_WAIT chSemResetI(&adcp->ad_sem, 0); chSchRescheduleS(); +#endif } else adcp->ad_state = ADC_READY; @@ -258,12 +262,15 @@ void adcStopConversionI(ADCDriver *adcp) { adc_lld_stop_conversion(adcp); adcp->ad_grpp = NULL; adcp->ad_state = ADC_READY; +#if ADC_USE_WAIT chSemResetI(&adcp->ad_sem, 0); +#endif } else adcp->ad_state = ADC_READY; } +#if ADC_USE_WAIT || defined(__DOXYGEN__) /** * @brief Waits for completion. * @details If the conversion is not completed or not yet started then the @@ -296,6 +303,7 @@ msg_t adcWaitConversion(ADCDriver *adcp, systime_t timeout) { chSysUnlock(); return RDY_OK; } +#endif /* ADC_USE_WAIT */ #endif /* CH_HAL_USE_ADC */ -- cgit v1.2.3