Fix pin free check to ignore None objects. Fixes #89
This commit is contained in:
parent
1a3bd67833
commit
3dda38c8ab
|
@ -55,7 +55,7 @@ void assert_pin(mp_obj_t obj, bool none_ok) {
|
|||
}
|
||||
|
||||
void assert_pin_free(const mcu_pin_obj_t* pin) {
|
||||
if (pin != NULL && !common_hal_mcu_pin_is_free(pin)) {
|
||||
if (pin != NULL && pin != MP_OBJ_TO_PTR(mp_const_none) && !common_hal_mcu_pin_is_free(pin)) {
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Pin %q in use", pin->name));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue