Add I2c target traits#26
Conversation
Cargo Vet Audit Passed
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a new embedded_mcu_hal::i2c::target API that defines both blocking and async I²C target/slave traits, along with shared request/status/error types, and wires the new module into the crate and workspace dependencies.
Changes:
- Add
i2c::targetmodule with shared types (Request, statuses, error kinds) plusblocking::I2candasync::I2ctraits. - Expose a new top-level
i2cmodule and addembedded-halas a workspace dependency. - Minor documentation link fixes in
timeandnvram, plus a.gitignoretweak.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| embedded-mcu-hal/src/time/mod.rs | Updates docs to reference unix_timestamp APIs. |
| embedded-mcu-hal/src/nvram.rs | Adds a missing intra-doc link target for storage. |
| embedded-mcu-hal/src/lib.rs | Exposes the new i2c module publicly. |
| embedded-mcu-hal/src/i2c/mod.rs | New I²C module root with re-exports and target submodule. |
| embedded-mcu-hal/src/i2c/target/mod.rs | Defines shared target-side request/status/error types and module docs. |
| embedded-mcu-hal/src/i2c/target/blocking.rs | Adds blocking I2c target trait. |
| embedded-mcu-hal/src/i2c/target/async.rs | Adds async I2c target trait and cancellation guidance. |
| embedded-mcu-hal/Cargo.toml | Adds embedded-hal dependency via workspace. |
| Cargo.toml | Defines embedded-hal in [workspace.dependencies]. |
| Cargo.lock | Locks embedded-hal dependency. |
| .gitignore | Anchors target/ ignore to the repo root. |
Both blocking and async versions
jerrysxie
left a comment
There was a problem hiding this comment.
Looks good, but some of the intended state transition might be tough to implement in hardware due to hardware feature that might auto advance state. After it is in, we should implement it on IMXRT and MCXA to see how it is.
Create issue to implement these traits for mcxa and imxrt: |
Add both blocking and async versions of the I2c Target trait.
while at that also normalize line endings to LF only.