Skip to content
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

I2C: sample SDA earlier #3040

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

I2C: sample SDA earlier #3040

wants to merge 1 commit into from

Conversation

bugadani
Copy link
Contributor

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • I have used cargo xtask fmt-packages command to ensure that all changed code is formatted correctly.
  • My changes were added to the CHANGELOG.md in the proper section.
  • I have added necessary changes to user code to the Migration Guide.
  • My changes are in accordance to the esp-rs API guidelines

Extra:

Pull Request Details 📖

Description

Please provide a clear and concise description of your changes, including the motivation behind these changes. The context is crucial for the reviewers.

Testing

Describe how you tested your changes.

@@ -1578,7 +1597,7 @@ impl Driver<'_> {
};
let scl_high = half_cycle - scl_wait_high;
let sda_hold = half_cycle / 4;
let sda_sample = half_cycle / 2 + scl_wait_high;
let sda_sample = half_cycle / 2;
Copy link
Contributor Author

@bugadani bugadani Jan 27, 2025

Choose a reason for hiding this comment

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

To be fair, I should probably remove the half_cycle/2 term instead. Technically, we can sample at any point after the rising edge, and scl_wait_high is supposed to be somewhat dependent on the hardware (i.e. it should be tunable, maybe). scl_wait_high represents the rising edge of the clock signal, after which the clock signal is high for scl_high. We should probably aim at the start/middle of the interval covered by scl_high.

Still, this should be good enough to test.

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.

1 participant