diff --git a/shared-bindings/keypad/KeyMatrix.c b/shared-bindings/keypad/KeyMatrix.c index 7a8bb97247a5..b832d74bded4 100644 --- a/shared-bindings/keypad/KeyMatrix.c +++ b/shared-bindings/keypad/KeyMatrix.c @@ -159,6 +159,9 @@ static void check_for_deinit(keypad_keymatrix_obj_t *self) { //| """Reset the internal state of the scanner to assume that all keys are now released. //| Any key that is already pressed at the time of this call will therefore immediately cause //| a new key-pressed event to occur. +//| For instance, if you call `reset()` immediately after creating a `KeyMatrix` object +//| at the beginning of your program, the events it generates will let you determine which keys +//| were being held down at program start. //| """ //| ... diff --git a/shared-bindings/keypad/Keys.c b/shared-bindings/keypad/Keys.c index 208bc0a62d49..996f13d8a13c 100644 --- a/shared-bindings/keypad/Keys.c +++ b/shared-bindings/keypad/Keys.c @@ -147,6 +147,9 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(keypad_keys___exit___obj, 4, 4, keypa //| """Reset the internal state of the scanner to assume that all keys are now released. //| Any key that is already pressed at the time of this call will therefore immediately cause //| a new key-pressed event to occur. +//| For instance, if you call `reset()` immediately after creating a `Keys` object +//| at the beginning of your program, the events it generates will let you determine which keys +//| were being held down at program start. //| """ //| ... diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index e74dce0ac237..8508619d9874 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -201,6 +201,9 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(keypad_shiftregisterkeys___exit___obj //| """Reset the internal state of the scanner to assume that all keys are now released. //| Any key that is already pressed at the time of this call will therefore immediately cause //| a new key-pressed event to occur. +//| For instance, if you call `reset()` immediately after creating a `ShiftRegisterKeys` object +//| at the beginning of your program, the events it generates will let you determine which keys +//| were being held down at program start. //| """ //| ... diff --git a/shared-bindings/keypad_demux/DemuxKeyMatrix.c b/shared-bindings/keypad_demux/DemuxKeyMatrix.c index 9f6d65c3dd33..8c867aecee08 100644 --- a/shared-bindings/keypad_demux/DemuxKeyMatrix.c +++ b/shared-bindings/keypad_demux/DemuxKeyMatrix.c @@ -147,6 +147,9 @@ static void check_for_deinit(keypad_demux_demuxkeymatrix_obj_t *self) { //| """Reset the internal state of the scanner to assume that all keys are now released. //| Any key that is already pressed at the time of this call will therefore immediately cause //| a new key-pressed event to occur. +//| For instance, if you call `reset()` immediately after creating a `DemuxKeyMatrix` object +//| at the beginning of your program, the events it generates will let you determine which keys +//| were being held down at program start. //| """ //| ... diff --git a/shared-module/keypad/__init__.c b/shared-module/keypad/__init__.c index e43c7bce4fb0..80e61f3ec7b6 100644 --- a/shared-module/keypad/__init__.c +++ b/shared-module/keypad/__init__.c @@ -140,7 +140,7 @@ void keypad_never_reset(keypad_scanner_obj_t *self) { void common_hal_keypad_generic_reset(void *self_in) { keypad_scanner_obj_t *self = self_in; size_t key_count = common_hal_keypad_generic_get_key_count(self); - memset(self->debounce_counter, self->debounce_threshold, key_count); + memset(self->debounce_counter, -self->debounce_threshold, key_count); keypad_scan_now(self, port_get_raw_ticks(NULL)); }