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

Adds support for I2CEncoder. #55

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

Conversation

cameronprince
Copy link

No description provided.

@peterhinch
Copy link
Owner

To add to my other comments, these are my thoughts on a driver for an I2C encoder.

  • There is no need to use interrupts. Polling is fast enough and avoids the problems of interrupt context. Note that the pushbutton drivers rely on polling.
  • The driver should run an async loop which periodically (~100ms?) reads the position of the encoder.
  • It subtracts the position from that last read.
  • If the difference is positive it signals the GUI for a forward step, if negative a backward step.
  • A zero difference has no effect.

Such a driver could be quite simple.

My encoder driver is something of a special case in its use of interrupts. This is to reduce the likelihood of a missed edge (even in the presence of contact bounce). The I2C chip handles all this nasty hardware stuff, meaning that long gaps can occur between reads.

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.

2 participants