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 6
6
7
7
## [ Unreleased] - ReleaseDate
8
8
9
+ ### Added
10
+
11
+ - [ #161 ] ( https://github.com/jamwaffles/ssd1306/pull/161 ) Added a ` set_mirror ` method to enable or disable display mirroring.
12
+
9
13
## [ 0.7.0] - 2021-07-08
10
14
11
15
### Changed
Original file line number Diff line number Diff line change @@ -314,6 +314,33 @@ where
314
314
Ok ( ( ) )
315
315
}
316
316
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
+
317
344
/// Change the display brightness.
318
345
pub fn set_brightness ( & mut self , brightness : Brightness ) -> Result < ( ) , DisplayError > {
319
346
// 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