Skip to content

Add I2c target traits#26

Merged
felipebalbi merged 4 commits into
OpenDevicePartnership:mainfrom
felipebalbi:i2c-slave
May 14, 2026
Merged

Add I2c target traits#26
felipebalbi merged 4 commits into
OpenDevicePartnership:mainfrom
felipebalbi:i2c-slave

Conversation

@felipebalbi
Copy link
Copy Markdown
Contributor

@felipebalbi felipebalbi commented May 11, 2026

Add both blocking and async versions of the I2c Target trait.

while at that also normalize line endings to LF only.

Copilot AI review requested due to automatic review settings May 11, 2026 15:31
@felipebalbi felipebalbi requested a review from a team as a code owner May 11, 2026 15:31
@felipebalbi felipebalbi self-assigned this May 11, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

Cargo Vet Audit Passed

cargo vet has passed in this PR. No new unvetted dependencies were found.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::target module with shared types (Request, statuses, error kinds) plus blocking::I2c and async::I2c traits.
  • Expose a new top-level i2c module and add embedded-hal as a workspace dependency.
  • Minor documentation link fixes in time and nvram, plus a .gitignore tweak.

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.

Comment thread embedded-mcu-hal/src/i2c/mod.rs
Comment thread embedded-mcu-hal/src/lib.rs
Comment thread embedded-mcu-hal/src/i2c/target/mod.rs Outdated
Comment thread embedded-mcu-hal/src/i2c/target/blocking.rs Outdated
Comment thread embedded-mcu-hal/src/i2c/target/asynch.rs Outdated
Both blocking and async versions
@felipebalbi felipebalbi requested a review from a team as a code owner May 11, 2026 15:49
Comment thread embedded-mcu-hal/src/i2c/target/asynch.rs
Copy link
Copy Markdown
Contributor

@jerrysxie jerrysxie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jerrysxie
Copy link
Copy Markdown
Contributor

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:

@felipebalbi felipebalbi enabled auto-merge (squash) May 13, 2026 01:18
@felipebalbi felipebalbi merged commit 8580385 into OpenDevicePartnership:main May 14, 2026
9 checks passed
@felipebalbi felipebalbi deleted the i2c-slave branch May 14, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create I2C target/slave trait

4 participants