Fix pin_or_none

This commit is contained in:
Scott Shawcroft 2023-01-12 16:03:45 -08:00
parent aa2ba4d88b
commit 987d9a31c8
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
1 changed files with 4 additions and 1 deletions

View File

@ -103,7 +103,10 @@ const mcu_pin_obj_t *validate_obj_is_pin_in(mp_obj_t obj, qstr arg_name) {
// Validate that the obj is a pin or None. Return an mcu_pin_obj_t* or NULL, correspondingly.
const mcu_pin_obj_t *validate_obj_is_pin_or_none(mp_obj_t obj, qstr arg_name) {
return MP_OBJ_TO_PTR(mp_arg_validate_type(obj, &mcu_pin_type, arg_name));
if (obj == mp_const_none) {
return NULL;
}
return validate_obj_is_pin(obj, arg_name);
}
const mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj, qstr arg_name) {