aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32F1xx
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-09-30 15:40:06 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-09-30 15:40:06 +0000
commit2a74bb8d6c4e707e58b198ed5a1b69199dcb9103 (patch)
treead10e130c89159b501907e65f785a5ac711fcb74 /os/hal/platforms/STM32F1xx
parentdfe1ebcefa6c5f5fd7ee60da8d84d7c5e1015341 (diff)
downloadChibiOS-2a74bb8d6c4e707e58b198ed5a1b69199dcb9103.tar.gz
ChibiOS-2a74bb8d6c4e707e58b198ed5a1b69199dcb9103.tar.bz2
ChibiOS-2a74bb8d6c4e707e58b198ed5a1b69199dcb9103.zip
Updated STM32F1, F2, F4, L1 ADC drivers to allow HW triggering.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4728 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32F1xx')
-rw-r--r--os/hal/platforms/STM32F1xx/adc_lld.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/os/hal/platforms/STM32F1xx/adc_lld.c b/os/hal/platforms/STM32F1xx/adc_lld.c
index c5fb252a8..d87cc7917 100644
--- a/os/hal/platforms/STM32F1xx/adc_lld.c
+++ b/os/hal/platforms/STM32F1xx/adc_lld.c
@@ -181,7 +181,7 @@ void adc_lld_stop(ADCDriver *adcp) {
* @notapi
*/
void adc_lld_start_conversion(ADCDriver *adcp) {
- uint32_t mode, n;
+ uint32_t mode, n, cr2;
const ADCConversionGroup *grpp = adcp->grpp;
/* DMA setup.*/
@@ -203,7 +203,10 @@ void adc_lld_start_conversion(ADCDriver *adcp) {
/* ADC setup.*/
adcp->adc->CR1 = grpp->cr1 | ADC_CR1_SCAN;
- adcp->adc->CR2 = grpp->cr2 | ADC_CR2_DMA | ADC_CR2_CONT | ADC_CR2_ADON;
+ cr2 = grpp->cr2 | ADC_CR2_DMA | ADC_CR2_ADON;
+ if ((cr2 & (ADC_CR2_EXTTRIG | ADC_CR2_JEXTTRIG)) == 0)
+ cr2 |= ADC_CR2_CONT;
+ adcp->adc->CR2 = grpp->cr2 | cr2;
adcp->adc->SMPR1 = grpp->smpr1;
adcp->adc->SMPR2 = grpp->smpr2;
adcp->adc->SQR1 = grpp->sqr1;
@@ -211,7 +214,7 @@ void adc_lld_start_conversion(ADCDriver *adcp) {
adcp->adc->SQR3 = grpp->sqr3;
/* ADC start by writing ADC_CR2_ADON a second time.*/
- adcp->adc->CR2 = grpp->cr2 | ADC_CR2_DMA | ADC_CR2_CONT | ADC_CR2_ADON;
+ adcp->adc->CR2 = cr2;
}
/**