rust-embedded-community / ssd1306

SSD1306 OLED driver
Apache License 2.0
310 stars 70 forks source link

Horizontal/vertical flip #47

Open jamwaffles opened 6 years ago

jamwaffles commented 6 years ago

On top of rotations a display mirror/flip should also be settable. I propose adding a DisplayFlip trait that allows opt-in flipping both horizontally and vertically.

mjadczak commented 5 years ago

Seems like this could be implemented very cheaply by letting the display chip do it: the A0h/A1h "segment re-map" commands seem to do exactly this.

jamwaffles commented 5 years ago

Most likely! The rotation options use segment remap with another option to make the display do the rotation itself. Implementing display flip should be pretty simple using one option or the other for horizontal/vertical flip.

mjadczak commented 5 years ago

On my ssd1306 chip at least (just a cheap one from AliExpress), the current Rotate90 and Rotate270 options actually flip the display horizontally (Rotate180 does actually rotate it, Rotate270 rotates 180º and then horizontally flips):

IMG_3526

jamwaffles commented 5 years ago

Just to clarify, the rotation behaviour is only broken in TerminalMode. GraphicsMode works as expected.

jamwaffles commented 5 years ago

TerminalMode rotation bug moved to #85. This issue will remain open as a tracker for the original flip feature.