Skip to content

Fix regression of keypad.*.reset() behavior: send key_pressed events #9819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions shared-bindings/keypad/KeyMatrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//| """
//| ...

Expand Down
3 changes: 3 additions & 0 deletions shared-bindings/keypad/Keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//| """
//| ...

Expand Down
3 changes: 3 additions & 0 deletions shared-bindings/keypad/ShiftRegisterKeys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//| """
//| ...

Expand Down
3 changes: 3 additions & 0 deletions shared-bindings/keypad_demux/DemuxKeyMatrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//| """
//| ...

Expand Down
2 changes: 1 addition & 1 deletion shared-module/keypad/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down