Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ with the [embedded-hal](crates.io/crates/embedded-hal) traits for maximum portab

## [Unreleased] - ReleaseDate

### Added

- [#20](https://github.com/jamwaffles/sh1106/pull/20) Add `set_contrast` method to set the display contrast/brightness.

## [0.3.1] - 2020-03-21

### Fixed
Expand Down
5 changes: 5 additions & 0 deletions src/mode/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ where
pub fn set_rotation(&mut self, rot: DisplayRotation) -> Result<(), DI::Error> {
self.properties.set_rotation(rot)
}

/// Set the display contrast
pub fn set_contrast(&mut self, contrast: u8) -> Result<(), DI::Error> {
self.properties.set_contrast(contrast)
}
}

#[cfg(feature = "graphics")]
Expand Down
5 changes: 5 additions & 0 deletions src/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,9 @@ where
}
}
}

/// Set the display contrast
pub fn set_contrast(&mut self, contrast: u8) -> Result<(), DI::Error> {
Command::Contrast(contrast).send(&mut self.iface)
}
}