From 2e67d6708dcd50d54bb0757b8745fb61262e1a9c Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 23 Jun 2021 15:42:31 -0400 Subject: [PATCH] check_for_deinit() more places in scanners --- shared-bindings/keypad/KeyMatrix.c | 5 +++++ shared-bindings/keypad/Keys.c | 5 +++++ shared-bindings/keypad/ShiftRegisterKeys.c | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/shared-bindings/keypad/KeyMatrix.c b/shared-bindings/keypad/KeyMatrix.c index 83efdd5f16..0b854ef475 100644 --- a/shared-bindings/keypad/KeyMatrix.c +++ b/shared-bindings/keypad/KeyMatrix.c @@ -150,6 +150,7 @@ STATIC void check_for_deinit(keypad_keymatrix_obj_t *self) { //| STATIC mp_obj_t keypad_keymatrix_reset(mp_obj_t self_in) { keypad_keymatrix_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); common_hal_keypad_keymatrix_reset(self); return MP_ROM_NONE; @@ -162,6 +163,8 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_keymatrix_reset_obj, keypad_keymatrix_reset); //| STATIC mp_obj_t keypad_keymatrix_get_key_count(mp_obj_t self_in) { keypad_keymatrix_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_keypad_keymatrix_get_key_count(self)); } MP_DEFINE_CONST_FUN_OBJ_1(keypad_keymatrix_get_key_count_obj, keypad_keymatrix_get_key_count); @@ -231,6 +234,8 @@ MP_DEFINE_CONST_FUN_OBJ_3(keypad_keymatrix_row_column_to_key_number_obj, keypad_ //| STATIC mp_obj_t keypad_keymatrix_get_events(mp_obj_t self_in) { keypad_keymatrix_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return common_hal_keypad_keymatrix_get_events(self); } MP_DEFINE_CONST_FUN_OBJ_1(keypad_keymatrix_get_events_obj, keypad_keymatrix_get_events); diff --git a/shared-bindings/keypad/Keys.c b/shared-bindings/keypad/Keys.c index e9ed1346e8..d616bcff84 100644 --- a/shared-bindings/keypad/Keys.c +++ b/shared-bindings/keypad/Keys.c @@ -144,6 +144,7 @@ STATIC void check_for_deinit(keypad_keys_obj_t *self) { //| STATIC mp_obj_t keypad_keys_reset(mp_obj_t self_in) { keypad_keys_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); common_hal_keypad_keys_reset(self); return MP_ROM_NONE; @@ -156,6 +157,8 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_keys_reset_obj, keypad_keys_reset); //| STATIC mp_obj_t keypad_keys_get_key_count(mp_obj_t self_in) { keypad_keys_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_keypad_keys_get_key_count(self)); } MP_DEFINE_CONST_FUN_OBJ_1(keypad_keys_get_key_count_obj, keypad_keys_get_key_count); @@ -173,6 +176,8 @@ const mp_obj_property_t keypad_keys_key_count_obj = { //| STATIC mp_obj_t keypad_keys_get_events(mp_obj_t self_in) { keypad_keys_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return common_hal_keypad_keys_get_events(self); } MP_DEFINE_CONST_FUN_OBJ_1(keypad_keys_get_events_obj, keypad_keys_get_events); diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index 340960c718..c81e127601 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -148,6 +148,7 @@ STATIC void check_for_deinit(keypad_shiftregisterkeys_obj_t *self) { //| STATIC mp_obj_t keypad_shiftregisterkeys_reset(mp_obj_t self_in) { keypad_shiftregisterkeys_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); common_hal_keypad_shiftregisterkeys_reset(self); return MP_ROM_NONE; @@ -160,6 +161,8 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_shiftregisterkeys_reset_obj, keypad_shiftregist //| STATIC mp_obj_t keypad_shiftregisterkeys_get_key_count(mp_obj_t self_in) { keypad_shiftregisterkeys_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_keypad_shiftregisterkeys_get_key_count(self)); } MP_DEFINE_CONST_FUN_OBJ_1(keypad_shiftregisterkeys_get_key_count_obj, keypad_shiftregisterkeys_get_key_count); @@ -177,6 +180,8 @@ const mp_obj_property_t keypad_shiftregisterkeys_key_count_obj = { //| STATIC mp_obj_t keypad_shiftregisterkeys_get_events(mp_obj_t self_in) { keypad_shiftregisterkeys_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return common_hal_keypad_shiftregisterkeys_get_events(self); } MP_DEFINE_CONST_FUN_OBJ_1(keypad_shiftregisterkeys_get_events_obj, keypad_shiftregisterkeys_get_events);