-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I was looking into using keypad.ShiftRegisterKeys
and found the documentation confusing. I had to check the source code to understand how it works.
//| Create a `Keys` object that will scan keys attached to a parallel-in serial-out shift register
//| like the 74HC165 or CD4021.
//| Note that you may chain shift registers to load in as many values as you need.
//| Furthermore, you can put multiple shift registers in parallel and share clock and latch.
//|
//| Key number 0 is the first (or more properly, the zero-th) bit read. In the
//| 74HC165, this bit is labeled ``Q7``. Key number 1 will be the value of ``Q6``, etc.
//| With multiple data pins, key numbers of the next pin are sequentially to the current pin.
//|
//| An `EventQueue` is created when this object is created and is available in the `events` attribute.
Can we replace:
With multiple data pins, key numbers of the next pin are sequentially to the current pin.
with something like:
Key numbers are sequenced such that there are
key_count[0]
values read fromdata[0]
, followed bykey_count[1]
values read fromdata[1]
, etc.
Also, can we add to:
//| :param Union[microcontroller.Pin, Sequence[microcontroller.Pin]] data: the incoming shift register data pin(s)
to get:
//| :param Union[microcontroller.Pin, Sequence[microcontroller.Pin]] data: the incoming shift register data pin(s). When one
Microcontroller.Pin
is given, it is equivalent to a single element sequence.
And add to:
//| :param Union[int, Sequence[int]] key_count: number of data lines to clock in (per data pin)
to get:
//| :param Union[int, Sequence[int]] key_count: number of data lines to clock in (per data pin). When one
int
is given, it is equivalent to a single element sequence.
I'm happy to do a PR for you, if you agree this is what it should say (or give me feedback).