Skip to content

Commit e32b51a

Browse files
authored
Add DisplaySize configuration for 64x32 displays (#166)
1 parent b423c54 commit e32b51a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Added
1010

1111
- [#161](https://github.com/jamwaffles/ssd1306/pull/161) Added a `set_mirror` method to enable or disable display mirroring.
12+
- [#166](https://github.com/jamwaffles/ssd1306/pull/166) Added `DisplaySize` configuration for 64x32 displays
1213

1314
## [0.7.0] - 2021-07-08
1415

src/size.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,18 @@ impl DisplaySize for DisplaySize64x48 {
119119
Command::ComPinConfig(true, false).send(iface)
120120
}
121121
}
122+
123+
/// Size information for the common 64x32 variants
124+
#[derive(Debug, Copy, Clone)]
125+
pub struct DisplaySize64x32;
126+
impl DisplaySize for DisplaySize64x32 {
127+
const WIDTH: u8 = 64;
128+
const HEIGHT: u8 = 32;
129+
const OFFSETX: u8 = 32;
130+
const OFFSETY: u8 = 0;
131+
type Buffer = [u8; Self::WIDTH as usize * Self::HEIGHT as usize / 8];
132+
133+
fn configure(&self, iface: &mut impl WriteOnlyDataCommand) -> Result<(), DisplayError> {
134+
Command::ComPinConfig(true, false).send(iface)
135+
}
136+
}

0 commit comments

Comments
 (0)