Skip to content

Add I2C slave driver and examples#164

Open
korbin wants to merge 2 commits into
ch32-rs:mainfrom
korbin:i2c-slave
Open

Add I2C slave driver and examples#164
korbin wants to merge 2 commits into
ch32-rs:mainfrom
korbin:i2c-slave

Conversation

@korbin
Copy link
Copy Markdown
Contributor

@korbin korbin commented Apr 6, 2026

This PR adds an Embassy STM32/RP2xxx-esque async I2C slave driver to the HAL.

  • I've included two basic register slave examples (for the CH32X035 and CH32L103) but this code should work on all of the chips - I don't have any to test with.

Comment thread src/i2c/mod.rs

scl.set_as_af_output(AFType::OutputOpenDrain, Speed::High);
sda.set_as_af_output(AFType::OutputOpenDrain, Speed::High);
// On CH32X0, I2C pins are automatically set to open-drain by hardware.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Conflicts with #160 - either will work, if this one is merged first I will rebase.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I closed my PR in favor of this one.

@andelf andelf self-requested a review May 9, 2026 04:04
@aq1018
Copy link
Copy Markdown
Contributor

aq1018 commented May 14, 2026

@korbin

Do you mind rebasing this one? I will take a look after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants