Merge pull request #6138 from dhalbert/7.2.x-backport-6106

Backport 6106 (countio long-lived fix) to 7.2.x
This commit is contained in:
Dan Halbert 2022-03-10 13:46:04 -05:00 committed by GitHub
commit 6ce4cb6ff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,8 +52,8 @@ STATIC mp_obj_t countio_counter_make_new(const mp_obj_type_t *type, size_t n_arg
const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
const countio_edge_t edge = validate_edge(args[ARG_edge].u_obj, MP_QSTR_edge); const countio_edge_t edge = validate_edge(args[ARG_edge].u_obj, MP_QSTR_edge);
const digitalio_pull_t pull = validate_pull(args[ARG_pull].u_obj, MP_QSTR_pull); const digitalio_pull_t pull = validate_pull(args[ARG_pull].u_obj, MP_QSTR_pull);
// Make long-lived because some implementations use a pointer to the object as interrupt-handler data.
countio_counter_obj_t *self = m_new_obj(countio_counter_obj_t); countio_counter_obj_t *self = m_new_ll_obj(countio_counter_obj_t);
self->base.type = &countio_counter_type; self->base.type = &countio_counter_type;
common_hal_countio_counter_construct(self, pin, edge, pull); common_hal_countio_counter_construct(self, pin, edge, pull);