Skip to content

drivers: i2c: wch: Add support i2c target #92942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bozheng1988
Copy link

Add support i2c target for wch, tested on WCH-CH32V203EVT board

Copy link

Hello @bozheng1988, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

@kartben kartben requested a review from Copilot July 10, 2025 10:49
Copy link

@Copilot 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 adds I2C target (slave) mode support to the WCH I2C driver, enabling devices to act as I2C slaves in addition to the existing master functionality. The implementation includes interrupt handling for slave events and proper state management to handle both master and slave operations.

  • Adds I2C target mode configuration and state management
  • Implements slave event and error interrupt handling
  • Provides target registration and unregistration functions
Comments suppressed due to low confidence (1)

drivers/i2c/i2c_wch.c:589

  • The log message uses 'slave' terminology while the rest of the code uses 'target' terminology. Should be 'i2c: target unregistered' for consistency.
	LOG_DBG("i2c: slave unregistered");

Copy link

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.

3 participants