-
Notifications
You must be signed in to change notification settings - Fork 83
Display rotation #17
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
Display rotation #17
Conversation
examples/rotation_i2c.rs
Outdated
| let mut disp = Builder::new() | ||
| .with_rotation(DisplayRotation::Rotate90) | ||
| .connect_i2c(i2c); | ||
| disp.init(); |
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.
I smell new warnings here. ;)
We get 180 degree (vertical flip) rotation for free by twiddling some options. 90 and 270 degree rotations will need some processing in `set_pixel()` but that's no biggie.
Takes rotation into account. Useful for dynamically placing stuff on the display. You can have some code that will work on both a 128x32 and 128x64 display, for example.
This change means that the wirse come out the top of a CRIUS display by default, mimicking the behaviour currently in master.
therealprof
left a comment
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.
It looks okay to me. The example will cause new warnings due to ignored result and I think we should think about making some features (like rotation) also available after display initialisation.
|
Thanks for reviewing. Fixed the example warnings and added a |
|
Boss! |
Adds 0, 90, 180 and 270 degree rotations to the display. Usable like so:
Also adds the
get_dimensions()method so consumers of this driver can position stuff relative to the display size.