diff options
| author | Damien George <damien@micropython.org> | 2021-09-02 13:02:49 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-09-02 20:28:53 +1000 |
| commit | 05cd17e36fbc5d3606e34e430dc72549bd1d6708 (patch) | |
| tree | 861ee1b4107ecca5228c735efe03a6c7ad117cdf | |
| parent | 1083cb2f334f4891e4dc8094f3eaaa839d2e2626 (diff) | |
stm32/pin: Enable GPIO clock of pin if it's constructed without init.
Fixes issue #7363.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | ports/stm32/pin.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/stm32/pin.c b/ports/stm32/pin.c index f1c5eee85..ad153311e 100644 --- a/ports/stm32/pin.c +++ b/ports/stm32/pin.c @@ -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, mp_map_t kw_args; mp_map_init_fixed_table(&kw_args, n_kw, args + n_args); pin_obj_init_helper(pin, n_args - 1, args + 1, &kw_args); + } else { + // enable the peripheral clock so pin reading at least works + mp_hal_gpio_clock_enable(pin->gpio); } return MP_OBJ_FROM_PTR(pin); |
