Fix pin free check to ignore None objects. Fixes #89

This commit is contained in:
Scott Shawcroft 2017-02-19 12:59:31 +01:00
parent 1a3bd67833
commit 3dda38c8ab
1 changed files with 1 additions and 1 deletions

View File

@ -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));
}
}