raiden00pl commented on code in PR #16500:
URL: https://github.com/apache/nuttx/pull/16500#discussion_r2144774455


##########
arch/arm/src/stm32f0l0g0/stm32_adc.c:
##########
@@ -1132,6 +1155,19 @@ static void adc_common_cfg(struct stm32_dev_s *priv)
   uint32_t clrbits = 0;
   uint32_t setbits = 0;
 
+#if defined(CONFIG_STM32F0L0G0_STM32G0)
+
+  clrbits |= ADC_CCR_PRESC_MASK | ADC_CCR_VREFEN |
+             ADC_CCR_TSEN | ADC_CCR_VBATEN;
+
+#  ifdef STM32_ADC_CCR_PRESC
+  setbits |= STM32_ADC_CCR_PRESC;
+#  else
+  setbits |= ADC_CCR_PRESC_DIV4;
+#  endif
+
+#else
+

Review Comment:
   there is no point to use chip-specific code sections here, you can use 
something like this:
   ```suggestion
    #ifdef STM32_ADC_CCR_PRESC
     setbits |= STM32_ADC_CCR_PRESC;
   #endif
   
     /* REVISIT: for now we reset all CCR bits */
   
   clrbits |= ADC_CCR_PRESC_MASK | ADC_CCR_VREFEN |
                ADC_CCR_TSEN;
     
   #ifdef HAVE_ADC_VBAT
     clrbits |= ADC_CCR_VBATEN;
   #endif
   #ifdef HAVE_ADC_VLCD
     clrbits |= ADC_CCR_PRESC_MASK;
   #endif
   #ifdef HAVE_ADC_VLCD
     clrbits |= ADC_CCR_VLCDEN;
   #endif
   #ifdef HAVE_ADC_LFM
     clrbits |= ADC_CCR_LFMEN;
   #endif
   
   adccmn_modifyreg(priv, STM32_ADC_CCR_OFFSET, clrbits, setbits);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to