feat(usb_tcpm): add beta Type-C TCPM component with FUSB302 backend#284
feat(usb_tcpm): add beta Type-C TCPM component with FUSB302 backend#284
Conversation
7d8cbda to
d385b5d
Compare
d385b5d to
a2521f8
Compare
a2521f8 to
682177d
Compare
682177d to
0287c24
Compare
cb5b37f to
4db5132
Compare
4db5132 to
6fc87de
Compare
6fc87de to
2b4d969
Compare
|
FYI, to fix the failing linux host test, update the type_c:
disable:
- if: IDF_TARGET in ["linux"]
type_c_manager:
enable:
- if: SOC_USB_OTG_SUPPORTED == 1Since the And the The |
2b4d969 to
deca019
Compare
deca019 to
89384df
Compare
89384df to
82288c3
Compare
82288c3 to
6b55a08
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
tore-espressif
left a comment
There was a problem hiding this comment.
@igi540 Good job on finalizing this feature!
71fdfe8 to
4d258fd
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
4d258fd to
80824df
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
80824df to
768ae5b
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
768ae5b to
6dfa16b
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
6dfa16b to
c88dbe9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
c88dbe9 to
ea383b5
Compare
Add new type_c/usb_tcpm component with a minimal USB Type-C TCPM API for attach/detach detection, cable orientation, and power-role control. Implement FUSB302 backend and shared worker-task runtime managed by usb_tcpm_install()/usb_tcpm_uninstall() for multi-port IRQ handling. Add pd_fusb302 example, target test app, manifests, docs, and license. Align API/runtime details, naming, and sdkconfig defaults.
ea383b5 to
cbec63d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Summary
type_c/usb_tcpmcomponent (v0.1.0-beta1) providing a minimal USB Type-C CC/TCPM layer:cc2_active)rp_current_ma)esp_event(USB_TCPM_EVENT)usb_tcpm_get_status()usb_tcpm_install_config_t.task_stack/task_prio) instead of per-port task settings.typec_port_backend_t).type_c/usb_tcpm/examples/pd_fusb302showing I2C bus bring-up, library install, port creation, event handling, and one-shot status read.type_c/usb_tcpm/test_apps/pd_fusb302with setup/teardown create-destroy flow and leak checks (TEST_CASE("memory_leakage", "[type_c]"))..github/workflows/upload_component.ymland addtype_c/**in.build-test-rules.yml(disabled onlinuxand on targets without I2C support).Motivation
We need a small, reusable Type-C CC layer in
esp-usbto unblock early USB-PD stack work and to standardize integration of TCPC backends (starting with FUSB302).User-visible API
Public headers:
type_c/usb_tcpm/include/usb/usb_tcpm.htype_c/usb_tcpm/include/usb/fusb302.hKey APIs:
usb_tcpm_install()/usb_tcpm_uninstall()usb_tcpm_port_create_fusb302()/usb_tcpm_port_destroy()usb_tcpm_get_status()Notable API details:
usb_tcpm_install_config_tnow contains:task_stack(shared worker stack,0= default)task_prio(shared worker priority,0= default)usb_tcpm_port_config_tcontains:default_power_role,rp_currentsrc_vbus_gpio,src_vbus_gpio_nusb_tcpm_evt_attached_t(port,cc2_active,rp_current_ma)usb_tcpm_evt_detached_t(port)Events:
USB_TCPM_EVENTUSB_TCPM_EVENT_SINK_ATTACHED(payload:usb_tcpm_evt_attached_t)USB_TCPM_EVENT_SINK_DETACHED(payload:usb_tcpm_evt_detached_t)USB_TCPM_EVENT_SINK_RP_CURRENT_CHANGED(reserved, not emitted yet)USB_TCPM_EVENT_SOURCE_ATTACHED(payload:usb_tcpm_evt_attached_t)USB_TCPM_EVENT_SOURCE_DETACHED(payload:usb_tcpm_evt_detached_t)USB_TCPM_EVENT_ERROR(reserved/TBD)Notes / Limitations
0.1.0-beta1; API may evolve before v1.0.USB_TCPM_EVENT_SINK_RP_CURRENT_CHANGEDandUSB_TCPM_EVENT_ERRORare defined but not emitted yet.usb_tcpm_port_config_t::src_vbus_gpio(active-high,GPIO_NUM_NCif unused)usb_tcpm_port_config_t::src_vbus_gpio_n(active-low,GPIO_NUM_NCif unused)idf >= 5.4.How to test
SNK ATTACHED: cc2=<0|1>, rp=<...> mA/SRC ATTACHED: ...SNK DETACHED/SRC DETACHEDusb_tcpm_get_status()).Optional (Unity test app, requires FUSB302 hardware connected):
Related
Note
Medium Risk
Large new component with concurrency/ISR + I2C/GPIO interactions and event-driven state transitions; issues could manifest as flaky attach/detach behavior or resource leaks on supported targets.
Overview
Adds a new beta
type_c/usb_tcpmESP-IDF component that implements a minimal USB Type-C TCPM/CC layer withusb_tcpm_install()/usb_tcpm_uninstall(), port lifecycle APIs,USB_TCPM_EVENTattach/detach notifications, and a status snapshot API.Includes a first backend for the FUSB302 TCPC (I2C + INT) behind a backend abstraction, plus an example (
examples/pd_fusb302) and a Unity target test app (test_apps/pd_fusb302). CI/packaging is updated to build/publish the new component and to skiptype_c/**tests onlinuxor targets without I2C support.Written by Cursor Bugbot for commit cbec63d. This will update automatically on new commits. Configure here.