This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new e50a2d34d28 gpio: Fix GPIO expanders warnings
e50a2d34d28 is described below
commit e50a2d34d287219977f1b3489ad771e6a84c3fc7
Author: Jiri Vlasak <[email protected]>
AuthorDate: Fri Jul 31 11:52:18 2026 +0200
gpio: Fix GPIO expanders warnings
- ISO1H812G is *output* only expander, not input.
- Warning make sense when we try to set the expander the wrong way.
Signed-off-by: Jiri Vlasak <[email protected]>
---
drivers/ioexpander/iso1h812g.c | 11 ++++++++---
drivers/ioexpander/iso1i813t.c | 8 ++++++--
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/ioexpander/iso1h812g.c b/drivers/ioexpander/iso1h812g.c
index c87ff278306..874488f939e 100644
--- a/drivers/ioexpander/iso1h812g.c
+++ b/drivers/ioexpander/iso1h812g.c
@@ -181,8 +181,8 @@ static void iso1h812g_deselect(FAR struct spi_dev_s *spi,
* Name: iso1h812g_direction
*
* Description:
- * ISO1H812G is only input pin. However interface is provided in order
- * to avoid system falls if called.
+ * ISO1H812G is only output expander. However interface is provided in
+ * order to avoid system falls if called.
*
* Input Parameters:
* dev - Device-specific state data
@@ -201,7 +201,12 @@ static int iso1h812g_direction(FAR struct ioexpander_dev_s
*dev,
DEBUGASSERT(priv != NULL && priv->config != NULL);
- gpiowarn("WARNING: ISO1H812G is only input expander!\n");
+ if (IOEXPANDER_DIRECTION_IN == direction
+ || IOEXPANDER_DIRECTION_IN_PULLUP == direction
+ || IOEXPANDER_DIRECTION_IN_PULLDOWN == direction)
+ {
+ gpiowarn("WARNING: ISO1H812G is only output expander!\n");
+ }
return OK;
}
diff --git a/drivers/ioexpander/iso1i813t.c b/drivers/ioexpander/iso1i813t.c
index 26018a3e8db..de265bb7600 100644
--- a/drivers/ioexpander/iso1i813t.c
+++ b/drivers/ioexpander/iso1i813t.c
@@ -180,7 +180,7 @@ static void iso1i813t_deselect(FAR struct spi_dev_s *spi,
* Name: iso1i813t_direction
*
* Description:
- * ISO1I813T is only input pin. However interface is provided in order
+ * ISO1I813T is only input expander. However interface is provided in order
* to avoid system falls if called.
*
* Input Parameters:
@@ -200,7 +200,11 @@ static int iso1i813t_direction(FAR struct ioexpander_dev_s
*dev,
DEBUGASSERT(priv != NULL && priv->config != NULL);
- gpiowarn("WARNING: ISO1I813T is only input expander!\n");
+ if (IOEXPANDER_DIRECTION_OUT == direction
+ || IOEXPANDER_DIRECTION_OUT_OPENDRAIN == direction)
+ {
+ gpiowarn("WARNING: ISO1I813T is only input expander!\n");
+ }
return OK;
}