diff options
author | Rocco Marco Guglielmi <roccomarco.guglielmi@live.com> | 2016-05-05 17:32:26 +0000 |
---|---|---|
committer | Rocco Marco Guglielmi <roccomarco.guglielmi@live.com> | 2016-05-05 17:32:26 +0000 |
commit | 3743bc199cfe7386dc231f2cd85ab05eff25ef63 (patch) | |
tree | 7a887af6a0994cfc683169e23fe356fde27347a6 /os/hal/ports/STM32/LLD | |
parent | 7226b7240cd1890d3108aca9286c06b9765a3d5b (diff) | |
download | ChibiOS-3743bc199cfe7386dc231f2cd85ab05eff25ef63.tar.gz ChibiOS-3743bc199cfe7386dc231f2cd85ab05eff25ef63.tar.bz2 ChibiOS-3743bc199cfe7386dc231f2cd85ab05eff25ef63.zip |
Fixed bug #737
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9423 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/STM32/LLD')
-rw-r--r-- | os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c | 14 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c b/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c index 019e85b5d..ba987adc9 100644 --- a/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c +++ b/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c @@ -520,12 +520,20 @@ void adc_lld_init(void) { /* ADC units pre-initializations.*/
#if defined(STM32F3XX)
+#if STM32_HAS_ADC1 && STM32_HAS_ADC2
#if STM32_ADC_USE_ADC1 || STM32_ADC_USE_ADC2
rccEnableADC12(FALSE);
rccResetADC12();
ADC1_2_COMMON->CCR = STM32_ADC_ADC12_CLOCK_MODE | ADC_DMA_MDMA;
rccDisableADC12(FALSE);
#endif
+#else
+#if STM32_ADC_USE_ADC1
+ rccEnableADC12(FALSE);
+ rccResetADC12();
+ ADC1_COMMON->CCR = STM32_ADC_ADC12_CLOCK_MODE | ADC_DMA_MDMA;
+ rccDisableADC12(FALSE);
+#endif
#if STM32_ADC_USE_ADC3 || STM32_ADC_USE_ADC4
rccEnableADC34(FALSE);
rccResetADC34();
@@ -533,6 +541,7 @@ void adc_lld_init(void) { rccDisableADC34(FALSE);
#endif
#endif
+#endif
#if defined(STM32L4XX)
rccEnableADC123(FALSE);
@@ -726,13 +735,18 @@ void adc_lld_stop(ADCDriver *adcp) { #endif
#if defined(STM32F3XX)
+#if STM32_HAS_ADC1 || STM32_HAS_ADC2
if ((clkmask & 0x3) == 0) {
rccDisableADC12(FALSE);
}
+#endif
+
+#if STM32_HAS_ADC3 || STM32_HAS_ADC4
if ((clkmask & 0xC) == 0) {
rccDisableADC34(FALSE);
}
#endif
+#endif
#if defined(STM32L4XX)
if ((clkmask & 0x7) == 0) {
diff --git a/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.h b/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.h index bb4d459cb..2a295aead 100644 --- a/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.h +++ b/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.h @@ -414,9 +414,11 @@ #endif
/* ISR arrangments checks.*/
+#if STM32_HAS_ADC1 && STM32_HAS_ADC2
#if STM32_ADC1_NUMBER != STM32_ADC2_NUMBER
#error "ADCv3 driver expects STM32_ADC1_NUMBER == STM32_ADC2_NUMBER from registry"
#endif
+#endif
/* ADC IRQ priority tests.*/
#if STM32_ADC_USE_ADC1 && \
|