esp32/mods/machpin.c
pin_obj_t *pin_find(mp_obj_t user_obj) {
    pin_obj_t *pin_obj;

    // if a pin was provided, use it
    if (MP_OBJ_IS_TYPE(user_obj, &pin_type)) {
        return user_obj;
    }

    // see if the pin name matches a expansion board pin
    pin_obj = pin_find_named_pin(&pin_exp_board_pins_locals_dict, user_obj);
    if (pin_obj) {
        return pin_obj;
    }

    // otherwise see if the pin name matches a module pin
    pin_obj = pin_find_named_pin(&pin_module_pins_locals_dict, user_obj);
    if (pin_obj) {
        return pin_obj;
    }

    nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
}
// C API used to convert a user-supplied pin name into an ordinal pin number
// If the pin is a board and it's not found in the pin list, it will be created
C API used to convert a user-supplied pin name into an ordinal pin number
If the pin is a board and it's not found in the pin list, it will be created
C API used to convert a user - supplied pin name into an ordinal pin number If the pin is a board and it ' s not found in the pin list it will be created
pin_obj_t *pin_find(mp_obj_t user_obj) {
    pin_obj_t *pin_obj;
    if (MP_OBJ_IS_TYPE(user_obj, &pin_type)) {
        return user_obj;
    }
    pin_obj = pin_find_named_pin(&pin_exp_board_pins_locals_dict, user_obj);
    if (pin_obj) {
        return pin_obj;
    }
    pin_obj = pin_find_named_pin(&pin_module_pins_locals_dict, user_obj);
    if (pin_obj) {
        return pin_obj;
    }
    nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
}
pin_obj_t * pin_find ( mp_obj_t user_obj ) { pin_obj_t * pin_obj ; if ( MP_OBJ_IS_TYPE ( user_obj , & pin_type ) ) { return user_obj ; } pin_obj = pin_find_named_pin ( & pin_exp_board_pins_locals_dict , user_obj ) ; if ( pin_obj ) { return pin_obj ; } pin_obj = pin_find_named_pin ( & pin_module_pins_locals_dict , user_obj ) ; if ( pin_obj ) { return pin_obj ; } nlr_raise ( mp_obj_new_exception_msg ( & mp_type_ValueError , mpexception_value_invalid_arguments ) ) ; }
C API used to convert a user-supplied pin name into an ordinal pin number
If the pin is a board and it's not found in the pin list, it will be created
C API used to convert a user - supplied pin name into an ordinal pin number If the pin is a board and it ' s not found in the pin list it will be created
// if a pin was provided, use it // see if the pin name matches a expansion board pin // otherwise see if the pin name matches a module pin