-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
keypad.ShiftRegisterKeys has wrong key_count #9718
Comments
For what it's worth, this test also fails the same way: import board
import keypad
keys = keypad.ShiftRegisterKeys(
- data = board.GP0,
+ data = (board.GP0),
clock = board.GP1,
latch = board.GP2,
- key_count = 8,
+ key_count = (8),
value_when_pressed = True,
value_to_latch = True,
) |
Try |
Thanks! I confirmed the workaround works. |
An aside: t = (
8,
9,
10,
) |
I have a fix for this in #9719. If you are interested in testing, the build artifacts are here: |
The fix looks good.
Thank you for the quick turnaround. |
CircuitPython version
Code/REPL
Behavior
Actual:
It looks like
Expected:
Description
See the original Adafruit Forum Post.
Just trying different values, it seems like the effective value of the
key_count
parameter iskey_count * 2 + 1
(so 8 => 17; 1 => 3)Additional information
I don't have a good way to step through this in the debugger, but I looked at the source. I don't see an obvious bug.
keypad_shiftregisterkeys_make_new
does this:to populate
args
and, specifically,args[ARG_key_count]
.Then it does:
And this:
And finally this:
common_hal_keypad_shiftregisterkeys_construct
does this:Taken together, I expect
self->num_key_counts
to be1
andself->key_counts[0]
to be8
andself->max_key_count
to be8
.But the logic analyzer seems to indicate
max_key_count
is17
.The text was updated successfully, but these errors were encountered: