Skip to content

Commit 3dda38c

Browse files
committed
Fix pin free check to ignore None objects. Fixes adafruit#89
1 parent 1a3bd67 commit 3dda38c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • shared-bindings/microcontroller

shared-bindings/microcontroller/Pin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void assert_pin(mp_obj_t obj, bool none_ok) {
5555
}
5656

5757
void assert_pin_free(const mcu_pin_obj_t* pin) {
58-
if (pin != NULL && !common_hal_mcu_pin_is_free(pin)) {
58+
if (pin != NULL && pin != MP_OBJ_TO_PTR(mp_const_none) && !common_hal_mcu_pin_is_free(pin)) {
5959
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Pin %q in use", pin->name));
6060
}
6161
}

0 commit comments

Comments
 (0)