Skip to content

Commit 6ce4cb6

Browse files
authored
Merge pull request #6138 from dhalbert/7.2.x-backport-6106
Backport 6106 (countio long-lived fix) to 7.2.x
2 parents 0957c15 + d365d1b commit 6ce4cb6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

shared-bindings/countio/Counter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ STATIC mp_obj_t countio_counter_make_new(const mp_obj_type_t *type, size_t n_arg
5252
const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
5353
const countio_edge_t edge = validate_edge(args[ARG_edge].u_obj, MP_QSTR_edge);
5454
const digitalio_pull_t pull = validate_pull(args[ARG_pull].u_obj, MP_QSTR_pull);
55-
56-
countio_counter_obj_t *self = m_new_obj(countio_counter_obj_t);
55+
// Make long-lived because some implementations use a pointer to the object as interrupt-handler data.
56+
countio_counter_obj_t *self = m_new_ll_obj(countio_counter_obj_t);
5757
self->base.type = &countio_counter_type;
5858

5959
common_hal_countio_counter_construct(self, pin, edge, pull);

0 commit comments

Comments
 (0)