summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-07-02 11:42:18 +1000
committerDamien George <damien@micropython.org>2025-07-08 08:57:48 +1000
commit49dbe1e272f486077bd16a6e68ece6d66a2bea7f (patch)
tree07b912c5897ba3aa6a6afd30f0353f14e1ae9ade
parentabcf023554df96f34e80e6eb73b9b705523ac5c5 (diff)
zephyr/machine_pin: Configure OUT pin also as input so it's readable.
Zephyr allows setting both GPIO_OUTPUT and GPIO_INPUT on a pin, which means it's an output pin that can have its current value read. Fixes issue #17596. Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--ports/zephyr/machine_pin.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ports/zephyr/machine_pin.c b/ports/zephyr/machine_pin.c
index 224019669..1baee656f 100644
--- a/ports/zephyr/machine_pin.c
+++ b/ports/zephyr/machine_pin.c
@@ -270,7 +270,7 @@ static const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
// class constants
{ MP_ROM_QSTR(MP_QSTR_IN), MP_ROM_INT(GPIO_INPUT) },
- { MP_ROM_QSTR(MP_QSTR_OUT), MP_ROM_INT(GPIO_OUTPUT) },
+ { MP_ROM_QSTR(MP_QSTR_OUT), MP_ROM_INT(GPIO_OUTPUT | GPIO_INPUT) },
{ MP_ROM_QSTR(MP_QSTR_PULL_UP), MP_ROM_INT(GPIO_PULL_UP) },
{ MP_ROM_QSTR(MP_QSTR_PULL_DOWN), MP_ROM_INT(GPIO_PULL_DOWN) },
{ MP_ROM_QSTR(MP_QSTR_IRQ_RISING), MP_ROM_INT(GPIO_INT_EDGE_RISING) },