8000 stm32/pin: Enable GPIO clock of pin if it's constructed without init. · micropython/micropython@05cd17e · GitHub
[go: up one dir, main page]

Skip to content

Commit 05cd17e

Browse files
committed
stm32/pin: Enable GPIO clock of pin if it's constructed without init.
Fixes issue #7363. Signed-off-by: Damien George <damien@micropython.org>
1 parent 1083cb2 commit 05cd17e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ports/stm32/pin.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
256256
mp_map_t kw_args;
257257
mp_map_init_fixed_table(&kw_args, n_kw, args + n_args);
258258
pin_obj_init_helper(pin, n_args - 1, args + 1, &kw_args);
259+
} else {
260+
// enable the peripheral clock so pin reading at least works
261+
mp_hal_gpio_clock_enable(pin->gpio);
259262
}
260263

261264
return MP_OBJ_FROM_PTR(pin);

0 commit comments

Comments
 (0)
0