casaroli commented on code in PR #17406:
URL: https://github.com/apache/nuttx/pull/17406#discussion_r4440557150


##########
boards/avr/avrdx/breadxavr/src/avrdx_init.c:
##########
@@ -77,15 +83,64 @@
 #ifdef CONFIG_BOARD_EARLY_INITIALIZE
 void board_early_initialize(void)
 {
+#  ifdef CONFIG_BREADXAVR_BUTTONS_DRIVER
   int ret = OK;
+#  endif
 
 #  ifdef CONFIG_BREADXAVR_BUTTONS_DRIVER
   ret = btn_lower_initialize("/dev/buttons");
   if (ret != OK)
     {
-      return;
+      PANIC();
     }
 #  endif
 }
 
 #endif /* CONFIG_BOARD_EARLY_INITIALIZE */
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *  Function called by the OS when BOARD_LATE_INITIALIZE is set.
+ *  Called after up_initialize, OS has been initialized at this point
+ *  and it is okay to initialize drivers. Running in special kernel
+ *  thread so waiting is allowed. Executed just before application code.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+#  ifdef CONFIG_BREADXAVR_TC74AX_SENSOR
+  FAR struct i2c_master_s *i2c;
+#  endif
+  int ret = OK;

Review Comment:
   `ret` is declared outside `#ifdef CONFIG_BREADXAVR_TC74AX_SENSOR`. 
`BOARD_LATE_INITIALIZE` is now `default y`, so breadxavr:nsh fails with "unused 
variable 'ret'" and -Werror (built on master with this file).
   
   Fix: declare `ret` inside the `#ifdef`, as `board_early_initialize()` does.



##########
boards/avr/avrdx/breadxavr/Kconfig:
##########
@@ -13,4 +13,26 @@ config BREADXAVR_BUTTONS_DRIVER
                If set, button driver registered as /dev/buttons
                for PORT A and PORT C (pins 2 and 3 for both ports.)
 
+config BREADXAVR_TC74AX_SENSOR
+       bool "Enable initializing I2C TC74Ax sensor"
+       depends on AVR_TWI0 && SENSORS_TC74AX

Review Comment:
   This depends on #17405, which is not merged and has two change requests. 
Without it `SENSORS_TC74AX` does not exist, and the link to 
`/components/drivers/special/sensors/tc74ax` breaks the documentation build 
(the red build-html job). Master now has a uORB TC74 driver (1b172fb8d2e, 
`SENSORS_TC74`, `tc74_register()`).
   
   Fix: rebase on master, use `depends on AVR_TWI0 && SENSORS_TC74`, call 
`tc74_register(0, i2c, 0x48 + CONFIG_BREADXAVR_TC74AX_SENSOR_VARIANT)`, and 
link `/os/drivers/special/sensors/tc74`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to