From 14b72519f7a97a0818f5fbfb0132eccc814609eb Mon Sep 17 00:00:00 2001 From: root Date: Sun, 28 Aug 2022 12:07:26 -0500 Subject: [PATCH] Make pulsein object long-lived --- shared-bindings/pulseio/PulseIn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index 41fc8b00c7..91bff1bff3 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -87,6 +87,7 @@ STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_arg mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + // Make object long-lived to avoid moving between imports pulseio_pulsein_obj_t *self = m_new_ll_obj(pulseio_pulsein_obj_t); self->base.type = &pulseio_pulsein_type;