[riot-notifications] [RIOT-OS/RIOT] cpu/stm32: added ADC for g0 (#16885)

benpicco notifications at github.com
Thu Sep 23 17:47:41 CEST 2021


Since this is almost identical with `adc_f0.c` why not do

```patch
--- a/cpu/stm32/periph/Makefile
+++ b/cpu/stm32/periph/Makefile
@@ -15,6 +15,8 @@ endif
 ifneq (,$(filter periph_adc,$(USEMODULE)))
   ifneq (,$(filter $(CPU_FAM),f4 f7))
     SRC += adc_f4_f7.c
+  else ifneq (,$(filter $(CPU_FAM),f0 f0))
+    SRC += adc_f0_g0.c
   else
     SRC += adc_$(CPU_FAM).c
   endif
diff --git a/cpu/stm32/periph/adc_f0.c b/cpu/stm32/periph/adc_f0.c
index 16e5f8d7bd..b33ae1a2de 100644
--- a/cpu/stm32/periph/adc_f0.c
+++ b/cpu/stm32/periph/adc_f0.c
@@ -33,12 +33,22 @@ static mutex_t lock = MUTEX_INIT;
 static inline void prep(void)
 {
     mutex_lock(&lock);
+#ifdef RCC_APB2ENR_ADCEN
     periph_clk_en(APB2, RCC_APB2ENR_ADCEN);
+#endif
+#ifdef RCC_APBENR2_ADCEN
+    periph_clk_en(APB2, RCC_APBENR2_ADCEN);
+#endif
 }
 
 static inline void done(void)
 {
+#ifdef RCC_APB2ENR_ADCEN
     periph_clk_dis(APB2, RCC_APB2ENR_ADCEN);
+#endif
+#ifdef RCC_APBENR2_ADCEN
+    periph_clk_dis(APB2, RCC_APBENR2_ADCEN);
+#endif
     mutex_unlock(&lock);
 }
```

instead?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16885#issuecomment-925936781
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210923/593ed258/attachment.htm>


More information about the notifications mailing list