Skip to content

Commit 987d9a3

Browse files
committed
Fix pin_or_none
1 parent aa2ba4d commit 987d9a3

File tree

1 file changed

+4
-1
lines changed
  • shared-bindings/microcontroller

1 file changed

+4
-1
lines changed

shared-bindings/microcontroller/Pin.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ const mcu_pin_obj_t *validate_obj_is_pin_in(mp_obj_t obj, qstr arg_name) {
103103

104104
// Validate that the obj is a pin or None. Return an mcu_pin_obj_t* or NULL, correspondingly.
105105
const mcu_pin_obj_t *validate_obj_is_pin_or_none(mp_obj_t obj, qstr arg_name) {
106-
return MP_OBJ_TO_PTR(mp_arg_validate_type(obj, &mcu_pin_type, arg_name));
106+
if (obj == mp_const_none) {
107+
return NULL;
108+
}
109+
return validate_obj_is_pin(obj, arg_name);
107110
}
108111

109112
const mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj, qstr arg_name) {

0 commit comments

Comments
 (0)