File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 66
77## [ Unreleased] - ReleaseDate
88
9+ ### Added
10+
11+ - [ #161 ] ( https://github.com/jamwaffles/ssd1306/pull/161 ) Added a ` set_mirror ` method to enable or disable display mirroring.
12+
913## [ 0.7.0] - 2021-07-08
1014
1115### Changed
Original file line number Diff line number Diff line change @@ -314,6 +314,33 @@ where
314314 Ok ( ( ) )
315315 }
316316
317+ /// Set mirror enabled/disabled.
318+ pub fn set_mirror ( & mut self , mirror : bool ) -> Result < ( ) , DisplayError > {
319+ if mirror {
320+ match self . rotation {
321+ DisplayRotation :: Rotate0 => {
322+ Command :: SegmentRemap ( false ) . send ( & mut self . interface ) ?;
323+ Command :: ReverseComDir ( true ) . send ( & mut self . interface ) ?;
324+ }
325+ DisplayRotation :: Rotate90 => {
326+ Command :: SegmentRemap ( false ) . send ( & mut self . interface ) ?;
327+ Command :: ReverseComDir ( false ) . send ( & mut self . interface ) ?;
328+ }
329+ DisplayRotation :: Rotate180 => {
330+ Command :: SegmentRemap ( true ) . send ( & mut self . interface ) ?;
331+ Command :: ReverseComDir ( false ) . send ( & mut self . interface ) ?;
332+ }
333+ DisplayRotation :: Rotate270 => {
334+ Command :: SegmentRemap ( true ) . send ( & mut self . interface ) ?;
335+ Command :: ReverseComDir ( true ) . send ( & mut self . interface ) ?;
336+ }
337+ } ;
338+ } else {
339+ self . set_rotation ( self . rotation ) ?;
340+ }
341+ Ok ( ( ) )
342+ }
343+
317344 /// Change the display brightness.
318345 pub fn set_brightness ( & mut self , brightness : Brightness ) -> Result < ( ) , DisplayError > {
319346 // Should be moved to Brightness::new once conditions can be used in const functions
You can’t perform that action at this time.
0 commit comments