From 6dab35e0766fd2f0b9e2aceea9940dd7cfc82057 Mon Sep 17 00:00:00 2001 From: Marco van der Kolk Date: Sat, 8 Jul 2023 15:21:58 +0200 Subject: [PATCH] Assign key_count to MP_ROM_NONE on deinit (for gc) Signed-off-by: Marco van der Kolk --- shared-module/keypad/ShiftRegisterKeys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-module/keypad/ShiftRegisterKeys.c b/shared-module/keypad/ShiftRegisterKeys.c index ae5fa35636..44a7e3323a 100644 --- a/shared-module/keypad/ShiftRegisterKeys.c +++ b/shared-module/keypad/ShiftRegisterKeys.c @@ -116,6 +116,7 @@ void common_hal_keypad_shiftregisterkeys_deinit(keypad_shiftregisterkeys_obj_t * common_hal_digitalio_digitalinout_deinit(self->data_pins->items[key]); } self->data_pins = MP_ROM_NONE; + self->key_counts = MP_ROM_NONE; common_hal_keypad_deinit_core(self); } @@ -125,8 +126,7 @@ size_t shiftregisterkeys_get_key_count(void *self_in) { size_t total = 0; - for (mp_uint_t i = 0; i < self->num_key_counts; i++) - { + for (mp_uint_t i = 0; i < self->num_key_counts; i++) { total += self->key_counts[i]; }