8000 shared-bindings: Update DigitalIO.pull docs and validate that third (… · boneskull/circuitpython@f570b53 · GitHub
[go: up one dir, main page]

Skip to content

Commit f570b53

Browse files
tannewtdhalbert
authored andcommitted
shared-bindings: Update DigitalIO.pull docs and validate that third (adafruit#188)
state is None and not anything. Fixes adafruit#187
1 parent 45a31b1 commit f570b53

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

shared-bindings/digitalio/DigitalInOut.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ const mp_obj_property_t digitalio_digitalio_drive_mode_obj = {
286286

287287
//| .. attribute:: pull
288288
//|
289-
//| Get or set the pin pull.
289+
//| Get or set the pin pull. Values may be `digitalio.Pull.UP`,
290+
//| `digitalio.Pull.DOWN` or ``None``.
290291
//|
291292
//| :raises AttributeError: if the direction is ~`digitalio.Direction.OUTPUT`.
292293
//|
@@ -317,6 +318,8 @@ STATIC mp_obj_t digitalio_digitalinout_obj_set_pull(mp_obj_t self_in, mp_obj_t p
317318
pull = PULL_UP;
318319
} else if (pull_obj == &digitalio_pull_down_obj) {
319320
pull = PULL_DOWN;
321+
} else if (pull_obj != mp_const_none) {
322+
mp_raise_ValueError("Unsupported pull value.");
320323
}
321324
common_hal_digitalio_digitalinout_set_pull(self, pull);
322325
return mp_const_none;

0 commit comments

Comments
 (0)
0