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

add get_pixel & toggle_pixel & extract shared code #194

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

thomas725
Copy link

Hi! Thank you for helping out with SSD1306 development! Please:

  • Check that you've added documentation to any new methods
  • Rebase from master if you're not already up to date
  • Add or modify an example if there are changes to the public API
  • Add a CHANGELOG.md entry in the Unreleased section under the appropriate heading (Added, Fixed, Changed, etc)
  • Run rustfmt on the project with cargo fmt --all - CI will not pass without this step
  • Check that your branch is up to date with master and that CI is passing once the PR is opened

PR description

alternative to #193 that also contains a toggle_pixel function.

thomas725 and others added 11 commits August 31, 2023 16:58
had to move track_changes call out of if block, therefore it will also run for invalid Y values (invalid X values where never caught anyway, they overflow into later Y values)
apply same fix we did for toggle_pixel to get_pixel, i.e. check the one bit and not all others instead:

`(1 << bit)` gives a 1 for the bit we want to read, and 0 for all others.
by applying a bit-wise AND operator between the current byte and this mask, we will only get something unequal to zero, if the bit we want to read is not zero:
`byte & (1 << bit)`
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.

None yet

1 participant