Skip to content

Commit b3ef870

Browse files
authored
Support 128x64 displays with no X offset (#22)
* Support 128x64 displays with no X offset * Changelog entry
1 parent 366e64a commit b3ef870

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
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+
- [#22](https://github.com/jamwaffles/sh1106/pull/22) Add `DisplaySize::Display128x64NoOffset` variant for 128x64 displays that don't use a 132x64 buffer internally.
14+
1115
## [0.3.2] - 2020-04-30
1216

1317
### Added
@@ -69,9 +73,9 @@ Upgrade to new embedded-graphics `0.6.0-alpha.1` release. Please see the [embedd
6973
- **(breaking)** #9 Upgraded to [embedded-graphics](https://crates.io/crates/embedded-graphics) 0.6.0-alpha.1
7074

7175
<!-- next-url -->
76+
7277
[unreleased]: https://github.com/jamwaffles/sh1106/compare/v0.3.2...HEAD
7378
[0.3.2]: https://github.com/jamwaffles/sh1106/compare/v0.3.1...v0.3.2
74-
7579
[0.3.1]: https://github.com/jamwaffles/sh1106/compare/v0.3.0...v0.3.1
7680
[0.3.0]: https://github.com/jamwaffles/sh1106/compare/v0.3.0-alpha.4...v0.3.0
7781
[0.3.0-alpha.4]: https://github.com/jamwaffles/sh1106/compare/v0.3.0-alpha.3...v0.3.0-alpha.4

src/displaysize.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
pub enum DisplaySize {
66
/// 128 by 64 pixels
77
Display128x64,
8+
/// 128 by 64 pixels without 2px X offset
9+
Display128x64NoOffset,
810
/// 128 by 32 pixels
911
Display128x32,
1012
/// 132 by 64 pixels
@@ -16,6 +18,7 @@ impl DisplaySize {
1618
pub fn dimensions(self) -> (u8, u8) {
1719
match self {
1820
DisplaySize::Display128x64 => (128, 64),
21+
DisplaySize::Display128x64NoOffset => (128, 64),
1922
DisplaySize::Display128x32 => (128, 32),
2023
DisplaySize::Display132x64 => (132, 64),
2124
}
@@ -25,6 +28,7 @@ impl DisplaySize {
2528
pub fn column_offset(self) -> u8 {
2629
match self {
2730
DisplaySize::Display128x64 => 2,
31+
DisplaySize::Display128x64NoOffset => 0,
2832
DisplaySize::Display128x32 => 2,
2933
DisplaySize::Display132x64 => 0,
3034
}

src/properties.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ where
6060

6161
match self.display_size {
6262
DisplaySize::Display128x32 => Command::ComPinConfig(false).send(&mut self.iface),
63-
DisplaySize::Display128x64 => Command::ComPinConfig(true).send(&mut self.iface),
64-
DisplaySize::Display132x64 => Command::ComPinConfig(true).send(&mut self.iface),
63+
DisplaySize::Display128x64
64+
| DisplaySize::Display128x64NoOffset
65+
| DisplaySize::Display132x64 => Command::ComPinConfig(true).send(&mut self.iface),
6566
}?;
6667

6768
Command::Contrast(0x80).send(&mut self.iface)?;

0 commit comments

Comments
 (0)