Skip to content

Commit 3a6a000

Browse files
authored
Add public method for setting screen contrast/brightness (#20)
1 parent 1582a03 commit 3a6a000

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ with the [embedded-hal](crates.io/crates/embedded-hal) traits for maximum portab
88

99
## [Unreleased] - ReleaseDate
1010

11+
### Added
12+
13+
- [#20](https://github.com/jamwaffles/sh1106/pull/20) Add `set_contrast` method to set the display contrast/brightness.
14+
1115
## [0.3.1] - 2020-03-21
1216

1317
### Fixed

src/mode/graphics.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ where
160160
pub fn set_rotation(&mut self, rot: DisplayRotation) -> Result<(), DI::Error> {
161161
self.properties.set_rotation(rot)
162162
}
163+
164+
/// Set the display contrast
165+
pub fn set_contrast(&mut self, contrast: u8) -> Result<(), DI::Error> {
166+
self.properties.set_contrast(contrast)
167+
}
163168
}
164169

165170
#[cfg(feature = "graphics")]

src/properties.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,9 @@ where
187187
}
188188
}
189189
}
190+
191+
/// Set the display contrast
192+
pub fn set_contrast(&mut self, contrast: u8) -> Result<(), DI::Error> {
193+
Command::Contrast(contrast).send(&mut self.iface)
194+
}
190195
}

0 commit comments

Comments
 (0)