You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/02/29 15:22:29 UTC
[incubator-nuttx] 06/13: Handle case where only ADC1 or ADC2 is
enabled.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch pr402
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit e405e5977364162ced47e6ed754359e9b083f95d
Author: Joshua Lange <jl...@2g-eng.com>
AuthorDate: Mon Feb 10 11:39:33 2020 -0600
Handle case where only ADC1 or ADC2 is enabled.
---
arch/arm/src/stm32h7/stm32_adc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm/src/stm32h7/stm32_adc.c b/arch/arm/src/stm32h7/stm32_adc.c
index 854034f..c3e6975 100644
--- a/arch/arm/src/stm32h7/stm32_adc.c
+++ b/arch/arm/src/stm32h7/stm32_adc.c
@@ -1329,13 +1329,15 @@ static int adc_setup(FAR struct adc_dev_s *dev)
/* Make sure that the ADC device is in the powered up, reset state.
* Since reset is shared between ADC1 and ADC2, don't reset one if the
- * other has already been reset.
+ * other has already been reset. (We only need to worry about this if both
+ * ADC1 and ADC2 are enabled.)
*/
-
+#if defined(CONFIG_STM32H7_ADC1) && defined(CONFIG_STM32H7_ADC2)
if ((dev == &g_adcdev1 &&
!((FAR struct stm32_dev_s *)g_adcdev2.ad_priv)->initialized) ||
(dev == &g_adcdev2 &&
!((FAR struct stm32_dev_s *)g_adcdev1.ad_priv)->initialized))
+#endif
{
adc_reset(dev);
}