Skip to content

Commit 31f1201

Browse files
authored
Resolve old TODO (#175)
* Resolve old TODO * Bump MSRV to 1.57
1 parent 897ab8e commit 31f1201

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
target_steps: &target_steps
22
docker:
3-
- image: cimg/rust:1.56.0
3+
- image: cimg/rust:1.57.0
44
steps:
55
- checkout
66
- restore_cache:

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
## [Unreleased] - ReleaseDate
88

9+
### Changed
10+
11+
- **(breaking)** [#175](https://github.com/jamwaffles/ssd1306/pull/175) Increased MSRV to 1.57.0
12+
913
## [0.7.1] - 2022-08-15
1014

1115
### Added

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ repository = "https://github.com/jamwaffles/ssd1306"
1111
version = "0.7.1"
1212
edition = "2018"
1313
exclude = [ "build.rs", "build.sh", "memory.x", "doc", "*.jpg", "*.png", "*.bmp" ]
14+
rust-version = "1.57"
1415

1516
[badges]
1617
circle-ci = { repository = "jamwaffles/ssd1306", branch = "master" }

src/brightness.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ impl Brightness {
4040
/// `contrast` sets the value used in the `0x81 Set Contrast Control` command and must be
4141
/// between 0 and 255. See section 10.1.7 of the SSD1306 datasheet for more information.
4242
const fn custom(precharge: u8, contrast: u8) -> Self {
43+
debug_assert!(
44+
0 < precharge && precharge <= 15,
45+
"Precharge value must be between 1 and 15"
46+
);
47+
4348
Self {
4449
precharge,
4550
contrast,

src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,6 @@ where
343343

344344
/// Change the display brightness.
345345
pub fn set_brightness(&mut self, brightness: Brightness) -> Result<(), DisplayError> {
346-
// Should be moved to Brightness::new once conditions can be used in const functions
347-
debug_assert!(
348-
0 < brightness.precharge && brightness.precharge <= 15,
349-
"Precharge value must be between 1 and 15"
350-
);
351-
352346
Command::PreChargePeriod(1, brightness.precharge).send(&mut self.interface)?;
353347
Command::Contrast(brightness.contrast).send(&mut self.interface)
354348
}

0 commit comments

Comments
 (0)