-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Fix AVR I2C master 1ms timeout #17174
Conversation
i2c_start() produces a minimum time_slice of 1ms for use as timeout value. The timer granularity is 1ms, it is entirely possible for timer_count to tick up immediately after the last timer read and falsely trigger timeout with a '>= 1' comparison.
72b7aa0
to
23aadba
Compare
Tested and verified on ProMicro - this fixes all glitches with the Cirque trackpads on I2C that caused sudden position jumps. |
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, as part of the correction you could swap all places to the ´timer_elapsed´ convenience function.
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.
Thanks for the fix and quick response.
* avr i2c_master: Fix 1ms timeout i2c_start() produces a minimum time_slice of 1ms for use as timeout value. The timer granularity is 1ms, it is entirely possible for timer_count to tick up immediately after the last timer read and falsely trigger timeout with a '>= 1' comparison. * avr/drivers/i2c_master: Use timer_elapsed()
* avr i2c_master: Fix 1ms timeout i2c_start() produces a minimum time_slice of 1ms for use as timeout value. The timer granularity is 1ms, it is entirely possible for timer_count to tick up immediately after the last timer read and falsely trigger timeout with a '>= 1' comparison. * avr/drivers/i2c_master: Use timer_elapsed()
i2c_start()
produces a minimumtime_slice
of 1ms for use as timeout value.The timer granularity is 1ms, it is entirely possible for
timer_count
to tick up immediately after the last timer read and falsely trigger timeout with a>= 1
comparison.Description
Types of Changes
Issues Fixed or Closed by This PR
Checklist