diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-03-23 12:46:54 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-03-23 12:46:54 +0000 |
commit | bfb849d86143d0ec85e591cc1091474511f476f4 (patch) | |
tree | 4ea15e31c95566f6882a76c7eeb06bc646f8aa2b /os/hal/platforms/STM32F37x/adc_lld.c | |
parent | 4708aa978b7c368e8edd56978ad923208de82266 (diff) | |
download | ChibiOS-bfb849d86143d0ec85e591cc1091474511f476f4.tar.gz ChibiOS-bfb849d86143d0ec85e591cc1091474511f476f4.tar.bz2 ChibiOS-bfb849d86143d0ec85e591cc1091474511f476f4.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5494 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32F37x/adc_lld.c')
-rw-r--r-- | os/hal/platforms/STM32F37x/adc_lld.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/os/hal/platforms/STM32F37x/adc_lld.c b/os/hal/platforms/STM32F37x/adc_lld.c index ad1979ae3..7c420326b 100644 --- a/os/hal/platforms/STM32F37x/adc_lld.c +++ b/os/hal/platforms/STM32F37x/adc_lld.c @@ -31,8 +31,6 @@ #if HAL_USE_ADC || defined(__DOXYGEN__)
-int debugzero = 0;
-
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
@@ -374,7 +372,7 @@ void adc_lld_start(ADCDriver *adcp) { PWR->CR |= PWR_CR_SDADC1EN;
adcp->sdadc->CR2 = 0;
adcp->sdadc->CR1 = (adcp->config->cr1 | SDADC_ENFORCED_CR1_FLAGS) &
- ~SDADC_FORBIDDEN_CR1_FLAGS;
+ ~SDADC_FORBIDDEN_CR1_FLAGS;
adcp->sdadc->CR2 = SDADC_CR2_ADON;
}
#endif /* STM32_ADC_USE_SDADC1 */
@@ -391,7 +389,7 @@ void adc_lld_start(ADCDriver *adcp) { PWR->CR |= PWR_CR_SDADC2EN;
adcp->sdadc->CR2 = 0;
adcp->sdadc->CR1 = (adcp->config->cr1 | SDADC_ENFORCED_CR1_FLAGS) &
- ~SDADC_FORBIDDEN_CR1_FLAGS;
+ ~SDADC_FORBIDDEN_CR1_FLAGS;
adcp->sdadc->CR2 = SDADC_CR2_ADON;
}
#endif /* STM32_ADC_USE_SDADC2 */
@@ -408,7 +406,7 @@ void adc_lld_start(ADCDriver *adcp) { PWR->CR |= PWR_CR_SDADC3EN;
adcp->sdadc->CR2 = 0;
adcp->sdadc->CR1 = (adcp->config->cr1 | SDADC_ENFORCED_CR1_FLAGS) &
- ~SDADC_FORBIDDEN_CR1_FLAGS;
+ ~SDADC_FORBIDDEN_CR1_FLAGS;
adcp->sdadc->CR2 = SDADC_CR2_ADON;
}
#endif /* STM32_ADC_USE_SDADC3 */
@@ -498,7 +496,11 @@ void adc_lld_start_conversion(ADCDriver *adcp) { #endif /* STM32_ADC_USE_ADC && STM32_ADC_USE_SDADC */
#if STM32_ADC_USE_ADC
{
- uint32_t cr2 = ADC_CR2_ADON;
+ uint32_t cr2 = adcp->adc->CR2 & ADC_CR2_TSVREFE;
+ cr2 |= grpp->u.adc.cr2 | ADC_CR2_DMA | ADC_CR2_ADON;
+ if ((cr2 & ADC_CR2_SWSTART) != 0)
+ cr2 |= ADC_CR2_CONT;
+ adcp->adc->CR2 = cr2;
/* ADC setup.*/
adcp->adc->SR = 0;
@@ -514,9 +516,7 @@ void adc_lld_start_conversion(ADCDriver *adcp) { /* ADC conversion start, the start is performed using the method
specified in the CR2 configuration, usually ADC_CR2_SWSTART.*/
adcp->adc->CR1 = grpp->u.adc.cr1 | ADC_CR1_AWDIE | ADC_CR1_SCAN;
- if ((grpp->u.adc.cr2 & ADC_CR2_SWSTART) != 0)
- cr2 |= ADC_CR2_CONT;
- adcp->adc->CR2 = grpp->u.adc.cr2 | cr2 | ADC_CR2_DMA | ADC_CR2_ADON;
+ adcp->adc->CR2 = adcp->adc->CR2; /* Triggers the conversion start.*/
}
#endif /* STM32_ADC_USE_ADC */
#if STM32_ADC_USE_ADC && STM32_ADC_USE_SDADC
|