-
Notifications
You must be signed in to change notification settings - Fork 214
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
Configurable I2C Timeout #1011
Configurable I2C Timeout #1011
Conversation
37bdee3
to
def8d69
Compare
def8d69
to
88ab35d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Thank you!
scl: impl Peripheral<P = SCL> + 'd, | ||
frequency: HertzU32, | ||
clocks: &Clocks, | ||
timeout: Option<u32>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels a bit strange to be mixing fugit
types with primitive types within the same API, is there a particular reason u32
was chosen here instead of say DurationU32
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timeout is not expressed in time but in 2 ^ timeout clock cycles ... while it would be possible trying to do a lot of math to have a duration here it's probably not really worth it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But maybe we should do it anyways - or document it at least
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The esp-idf also uses some non-time value here https://docs.espressif.com/projects/esp-idf/en/v4.3/esp32/api-reference/peripherals/i2c.html#_CPPv415i2c_set_timeout10i2c_port_ti . Not sure if anyone needs precise control over this or just "I need a higher timeout".
Hi, similar to what has been described in #352, I have a sensor requiring a higher i2c delay.
I tried to follow the hints from the discussion and added a second constructor taking a delay value.
I did not try to use any semantic time values (second part of the discussion in the issue above) but instead just pass the raw timeout (similar to what esp-idf does).
Let me know if there are any required changes required or whether this change requires me to actually run all of the examples.
Must
errors
orwarnings
.cargo fmt
was run.CHANGELOG.md
in the proper section.Nice to have