Skip to content

Commit 21d0864

Browse files
author
Marco van der Kolk
committed
updated documentation
1 parent 6dab35e commit 21d0864

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

shared-bindings/keypad/ShiftRegisterKeys.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
//| self,
4242
//| *,
4343
//| clock: microcontroller.Pin,
44-
//| data: microcontroller.Pin,
44+
//| data: Union[microcontroller.Pin, List[microcontroller.Pin]],
4545
//| latch: microcontroller.Pin,
4646
//| value_to_latch: bool = True,
47-
//| key_count: int,
47+
//| key_count: Union[int, List[int]]
4848
//| value_when_pressed: bool,
4949
//| interval: float = 0.020,
5050
//| max_events: int = 64
@@ -56,22 +56,22 @@
5656
//|
5757
//| Key number 0 is the first (or more properly, the zero-th) bit read. In the
5858
//| 74HC165, this bit is labeled ``Q7``. Key number 1 will be the value of ``Q6``, etc.
59+
//| When specifying multiple data pins, the key numbers are sequential.
60+
//| So with two data Pins in parallel and key_count[0] = 32, the keys of data[1] will start with 32.
5961
//|
6062
//| An `EventQueue` is created when this object is created and is available in the `events` attribute.
6163
//|
6264
//| :param microcontroller.Pin clock: The shift register clock pin.
6365
//| The shift register should clock on a low-to-high transition.
64-
//| :param microcontroller.Pin data: the incoming shift register data pin
65-
//| :param Sequence[microcontroller.Pin] data: a list of incoming shift register data pins
66+
//| :param Union[microcontroller.Pin, List[microcontroller.Pin]] data: the incoming shift register data pin(s)
6667
//| :param microcontroller.Pin latch:
6768
//| Pin used to latch parallel data going into the shift register.
6869
//| :param bool value_to_latch: Pin state to latch data being read.
6970
//| ``True`` if the data is latched when ``latch`` goes high
7071
//| ``False`` if the data is latched when ``latch`` goes low.
7172
//| The default is ``True``, which is how the 74HC165 operates. The CD4021 latch is the opposite.
7273
//| Once the data is latched, it will be shifted out by toggling the clock pin.
73-
//| :param int key_count: number of data lines to clock in
74-
//| :param Sequence[int] key_count: a list of key_counts equal sized to data pins
74+
//| :param Union[int, List[int]] key_count: number of data lines to clock in (per data pin)
7575
//| :param bool value_when_pressed: ``True`` if the pin reads high when the key is pressed.
7676
//| ``False`` if the pin reads low (is grounded) when the key is pressed.
7777
//| :param float interval: Scan keys no more often than ``interval`` to allow for debouncing.
@@ -84,7 +84,7 @@
8484
//| ...
8585

8686
STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
87-
#if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS
87+
#if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS
8888
keypad_shiftregisterkeys_obj_t *self = m_new_obj(keypad_shiftregisterkeys_obj_t);
8989
self->base.type = &keypad_shiftregisterkeys_type;
9090
enum { ARG_clock, ARG_data, ARG_latch, ARG_value_to_latch, ARG_key_count, ARG_value_when_pressed, ARG_interval, ARG_max_events };
@@ -159,9 +159,9 @@ STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, siz
159159

160160
return MP_OBJ_FROM_PTR(self);
161161

162-
#else
162+
#else
163163
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_ShiftRegisterKeys);
164-
#endif
164+
#endif
165165
}
166166

167167
#if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS
@@ -225,7 +225,7 @@ const mp_obj_type_t keypad_shiftregisterkeys_type = {
225225
{ &mp_type_type },
226226
.name = MP_QSTR_ShiftRegisterKeys,
227227
.make_new = keypad_shiftregisterkeys_make_new,
228-
#if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS
228+
#if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS
229229
.locals_dict = (mp_obj_t)&keypad_shiftregisterkeys_locals_dict,
230-
#endif
230+
#endif
231231
};

0 commit comments

Comments
 (0)