Skip to content

Conversation

@jamwaffles
Copy link
Collaborator

Adds 0, 90, 180 and 270 degree rotations to the display. Usable like so:

let mut disp = Builder::new()
    .with_rotation(DisplayRotation::Rotate90)
    .connect_i2c(i2c);

Also adds the get_dimensions() method so consumers of this driver can position stuff relative to the display size.

@jamwaffles jamwaffles added the enhancement New feature or request label Mar 22, 2018
@jamwaffles jamwaffles added this to the Release 0.1 milestone Mar 22, 2018
@jamwaffles jamwaffles requested a review from scowcron March 22, 2018 22:39
@jamwaffles jamwaffles requested a review from therealprof March 28, 2018 19:42
let mut disp = Builder::new()
.with_rotation(DisplayRotation::Rotate90)
.connect_i2c(i2c);
disp.init();
Copy link
Collaborator

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
therealprof previously approved these changes Mar 28, 2018
Copy link
Collaborator

@therealprof therealprof left a 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.

@jamwaffles
Copy link
Collaborator Author

Thanks for reviewing. Fixed the example warnings and added a set_rotation() method. Annoyingly it has to return a Result because it sets some config in the display. Makes the API a little messy but it's necessary.

@jamwaffles jamwaffles merged commit 7a2a895 into master Mar 28, 2018
@jamwaffles
Copy link
Collaborator Author

Boss!

@jamwaffles jamwaffles deleted the rotation2 branch March 28, 2018 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants