type-c-service/wrapper: Break out event receiver code#799
Open
RobertZ2011 wants to merge 1 commit intoOpenDevicePartnership:v0.2.0from
Open
type-c-service/wrapper: Break out event receiver code#799RobertZ2011 wants to merge 1 commit intoOpenDevicePartnership:v0.2.0from
RobertZ2011 wants to merge 1 commit intoOpenDevicePartnership:v0.2.0from
Conversation
Cargo Vet Audit Passed
|
7790502 to
0a1ad78
Compare
43db36e to
f2771f8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the Type‑C controller wrapper event handling by moving “wait/receive” responsibilities into a dedicated event receiver layer, and updates controller drivers/examples accordingly. It also updates the Type‑C interface and TPS6699x integration to align with the new eventing model.
Changes:
- Introduce
type-c-service::wrapper::event_receiverto centralize receiving/merging port, power-policy, CFU, PD-controller, and sink-ready-timeout events. - Refactor
PortEventStreamerto iterate over an iterator ofPortEventBitfield(instead of async closure-based per-port reads). - Remove
wait_port_event/clear_port_eventsfrom thetype_c_interface::port::Controllertrait and adapt TPS6699x + examples to the new interrupt/event pipeline; bumptps6699xdependency to branchv0.2.0.
Reviewed changes
Copilot reviewed 12 out of 20 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| type-c-service/src/wrapper/power.rs | Removes wrapper-side power command waiting logic (moved into event receiver). |
| type-c-service/src/wrapper/pd.rs | Moves sink-ready timeout tracking to SinkReadyTimeoutEvent. |
| type-c-service/src/wrapper/mod.rs | Removes wrapper “wait” loop; process_event/finalize now take event receiver components. |
| type-c-service/src/wrapper/event_receiver.rs | New event receiver module combining port/power/CFU/PD/sink-timeout event sources. |
| type-c-service/src/wrapper/cfu.rs | Routes CFU ticker handling through the new CFU event receiver. |
| type-c-service/src/wrapper/backing.rs | Adjusts storage wiring to expose CFU/PD controller pieces and return power proxy receivers separately. |
| type-c-service/src/lib.rs | Refactors PortEventStreamer into an Iterator over PortEventBitfield iterators; updates tests accordingly. |
| type-c-service/src/driver/tps6699x.rs | Removes old Controller event APIs; adds driver-side InterruptReceiver adapter for wrapper event receiver. |
| type-c-interface/src/port/mod.rs | Removes Controller::wait_port_event and Controller::clear_port_events from the public trait. |
| examples/std/src/lib/type_c/mock_controller.rs | Adds a mock interrupt receiver and removes old controller event buffering. |
| examples/std/src/bin/type_c/unconstrained.rs | Switches wrapper driving to ArrayPortEventReceivers + explicit process_event/finalize. |
| examples/std/src/bin/type_c/ucsi.rs | Switches wrapper driving to ArrayPortEventReceivers + explicit process_event/finalize. |
| examples/std/src/bin/type_c/service.rs | Switches wrapper driving to ArrayPortEventReceivers + explicit process_event/finalize. |
| examples/std/Cargo.lock | Lockfile updates (incl. TPS6699x source change). |
| examples/rt685s-evk/src/bin/type_c_cfu.rs | Updates RT685 example to new interrupt processor + wrapper event receiver. |
| examples/rt685s-evk/src/bin/type_c.rs | Updates RT685 example to new interrupt processor + wrapper event receiver. |
| examples/rt685s-evk/Cargo.toml | Pins tps6699x to branch = "v0.2.0". |
| examples/rt685s-evk/Cargo.lock | Lockfile updates (incl. TPS6699x source change). |
| Cargo.toml | Workspace tps6699x dependency switched to branch = "v0.2.0". |
| Cargo.lock | Workspace lockfile updates (incl. TPS6699x source change). |
02c8d17 to
3d1994d
Compare
3d1994d to
7a0c03f
Compare
* Move all code related to receiving events out of `wrapper::Wrapper` and into a separate event receiver struct. * Pull-in corresponding tps6699x changes. * Refactor `PortEventStreamer` to work over an iter of `PortEventBitfield`, simpifly logic. * Introduce temporary generics and public visibility.
7a0c03f to
c040644
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wrapper::Wrapperandinto a separate event receiver struct.
PortEventStreamerto work over an iter ofPortEventBitfield, simpifly logic.