davids5 commented on code in PR #12350:
URL: https://github.com/apache/nuttx/pull/12350#discussion_r1602775243


##########
arch/arm/src/stm32h7/stm32_rcc.c:
##########
@@ -59,7 +59,7 @@
 #elif defined(CONFIG_STM32H7_STM32H7B3XX)
 #  include "stm32h7x3xx_rcc.c"
 #elif defined(CONFIG_STM32H7_STM32H7X5XX)
-#  include "stm32h7x3xx_rcc.c"
+#  include "stm32h7x5xx_rcc.c"

Review Comment:
   @jfbblue0922 There is always a trade off to avoid #ifdef rash and having to 
maintain 2 IP Block files. 
   
   In this case A single `if def` is the better choice. If you can define a 
Single bit mask for the STM32H755II and one for the others.
   
   Then the code does a mask out and an OR in.
   
   In the top of the file define (Check the default of the mask out value and 
you may need 2 defines here, adjust the names a needed.)
   
   ```
   #if defined(ARCH_CHIP_STM32H755II)
   #  define PWR_CR3_VALUE  STM32_PWR_CR3_LDOEN 
   #else
   #  define PWR_CR3_VALUE  STM32_PWR_CR3_LDOEN|STM32_PWR_CR3_SCUEN 
   #endif
   ```
   
   Then Change the code to do the mask out as you have it.
   and `regval |= PWR_CR3_VALUE`
   
   The code stays readable and the maintenance will be free.



-- 
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