xiaoxiang781216 commented on code in PR #19558:
URL: https://github.com/apache/nuttx/pull/19558#discussion_r3658720764


##########
include/nuttx/ioexpander/pi4ioe5v6408.h:
##########
@@ -20,66 +20,91 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_RP23XX_PIMORONI_PICO_PLUS_2_W_INCLUDE_RP23XX_SPISD_H
-#define __BOARDS_ARM_RP23XX_PIMORONI_PICO_PLUS_2_W_INCLUDE_RP23XX_SPISD_H
+#ifndef __INCLUDE_NUTTX_IOEXPANDER_PI4IOE5V6408_H
+#define __INCLUDE_NUTTX_IOEXPANDER_PI4IOE5V6408_H
 
 /****************************************************************************
  * Included Files
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#ifdef CONFIG_PI4IOE5V6408_INT_ENABLE
+#  include <nuttx/irq.h>
+#endif
 
 /****************************************************************************
- * Public Types
+ * Pre-processor Definitions
  ****************************************************************************/
 
-#ifndef __ASSEMBLY__
+#define PI4IOE5V6408_I2C_ADDRESS_LOW   0x43
+#define PI4IOE5V6408_I2C_ADDRESS_HIGH  0x44
+#define PI4IOE5V6408_NPINS             8
+
+/* Power-up / soft-reset defaults.
+ * Direction: 1 = output, 0 = input.
+ * Pull select: 1 = pull-up, 0 = pull-down.
+ */
+
+#define PI4IOE5V6408_DIR_DEFAULT       0xff
+#define PI4IOE5V6408_OUT_DEFAULT       0x00
+#define PI4IOE5V6408_HIGHZ_DEFAULT     0xff
+#define PI4IOE5V6408_PULLEN_DEFAULT    0xff
+#define PI4IOE5V6408_PULLSEL_DEFAULT   0x00
 
 /****************************************************************************
- * Public Data
+ * Public Types
  ****************************************************************************/
 
-#undef EXTERN
-#if defined(__cplusplus)
-#define EXTERN extern "C"
-extern "C"
+struct i2c_master_s;
+struct ioexpander_dev_s;
+
+struct pi4ioe5v6408_config_s
 {
-#else
-#define EXTERN extern
+  uint8_t address;
+  uint32_t frequency;
+
+#ifdef CONFIG_PI4IOE5V6408_INT_ENABLE
+  CODE int (*attach)(FAR struct pi4ioe5v6408_config_s *config,
+                     xcpt_t isr, FAR void *arg);
+  CODE void (*enable)(FAR struct pi4ioe5v6408_config_s *config, bool enable);
 #endif
+};
 
 /****************************************************************************
  * Public Function Prototypes
  ****************************************************************************/
 
-/****************************************************************************
- * Name: board_spisd_initialize
- *
- * Description:
- *   Initialize the SPI-based SD card.
- *
- ****************************************************************************/
-
-#ifdef CONFIG_RP23XX_SPISD
-int board_spisd_initialize(int minor, int bus);
+#ifdef __cplusplus
+extern "C"
+{
 #endif
 
 /****************************************************************************
- * Name: board_spisd_status
+ * Name: pi4ioe5v6408_initialize
  *
  * Description:
- *   Get the status whether SD Card is present or not.
+ *   Instantiate and initialize a PI4IOE5V6408 I2C I/O expander.
+ *
+ * Input Parameters:
+ *   i2c    - I2C controller instance
+ *   config - Persistent board configuration
+ *
+ * Returned Value:
+ *   An ioexpander_dev_s instance on success, NULL on failure.
  *
  ****************************************************************************/
 
-#ifdef CONFIG_RP23XX_SPISD
-uint8_t board_spisd_status(struct spi_dev_s *dev, uint32_t devid);
-#endif
+FAR struct ioexpander_dev_s *
+pi4ioe5v6408_initialize(FAR struct i2c_master_s *i2c,
+                        FAR struct pi4ioe5v6408_config_s *config);

Review Comment:
   add const



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