From de68417250aa8de5c41426588ac5f1b15c540a1e Mon Sep 17 00:00:00 2001 From: elagil Date: Fri, 25 Jul 2025 13:24:27 +0200 Subject: [PATCH 1/2] feat: add 102x64 resolution variant --- src/prelude.rs | 2 +- src/size.rs | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/prelude.rs b/src/prelude.rs index bf5266a6..557da7af 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -9,7 +9,7 @@ pub use super::{ mode::DisplayConfig, rotation::DisplayRotation, size::{ - DisplaySize, DisplaySize128x32, DisplaySize128x64, DisplaySize64x32, DisplaySize64x48, + DisplaySize, DisplaySize102x64, DisplaySize128x32, DisplaySize128x64, DisplaySize64x32, DisplaySize64x48, DisplaySize72x40, DisplaySize96x16, }, }; diff --git a/src/size.rs b/src/size.rs index 62bca180..e0fd7b78 100644 --- a/src/size.rs +++ b/src/size.rs @@ -25,10 +25,7 @@ impl NewZeroed for [u8; N] { /// This includes resolution, offset and framebuffer size. #[maybe_async_cfg::maybe( sync(keep_self), - async( - feature = "async", - idents(WriteOnlyDataCommand(async = "AsyncWriteOnlyDataCommand")) - ) + async(feature = "async", idents(WriteOnlyDataCommand(async = "AsyncWriteOnlyDataCommand"))) )] pub trait DisplaySize { /// Width in pixels @@ -88,6 +85,25 @@ impl DisplaySize for DisplaySize128x64 { } } +/// Size information for the common 102x64 variants +#[derive(Debug, Copy, Clone)] +pub struct DisplaySize102x64; +#[maybe_async_cfg::maybe(sync(keep_self), async(feature = "async", keep_self))] +impl DisplaySize for DisplaySize102x64 { + const WIDTH: u8 = 102; + const HEIGHT: u8 = 64; + const OFFSETX: u8 = 13; + type Buffer = [u8; ::WIDTH as usize * + ::HEIGHT as usize / 8]; + + async fn configure( + &self, + iface: &mut impl WriteOnlyDataCommand, + ) -> Result<(), DisplayError> { + Command::ComPinConfig(true, false).send(iface).await + } +} + /// Size information for the common 128x32 variants #[derive(Debug, Copy, Clone)] pub struct DisplaySize128x32; From eae7b5eec00045c36039df2f35160d3316de4c7d Mon Sep 17 00:00:00 2001 From: elagil Date: Fri, 25 Jul 2025 13:30:08 +0200 Subject: [PATCH 2/2] fix: formatting --- CHANGELOG.md | 1 + src/prelude.rs | 4 ++-- src/size.rs | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dd276b0..8b072e34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ SSD1306 monochrome OLED display. ### Added - Implement `embedded_graphics::draw_target::DrawTarget::fill_contiguous` to more improve performance when filling contiguous regions. +- Added `DisplaySize102x64` ## [0.10.0] - 2025-03-22 ### Changed diff --git a/src/prelude.rs b/src/prelude.rs index 557da7af..8d779f1e 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -9,8 +9,8 @@ pub use super::{ mode::DisplayConfig, rotation::DisplayRotation, size::{ - DisplaySize, DisplaySize102x64, DisplaySize128x32, DisplaySize128x64, DisplaySize64x32, DisplaySize64x48, - DisplaySize72x40, DisplaySize96x16, + DisplaySize, DisplaySize102x64, DisplaySize128x32, DisplaySize128x64, DisplaySize64x32, + DisplaySize64x48, DisplaySize72x40, DisplaySize96x16, }, }; diff --git a/src/size.rs b/src/size.rs index e0fd7b78..c94da3d8 100644 --- a/src/size.rs +++ b/src/size.rs @@ -25,7 +25,10 @@ impl NewZeroed for [u8; N] { /// This includes resolution, offset and framebuffer size. #[maybe_async_cfg::maybe( sync(keep_self), - async(feature = "async", idents(WriteOnlyDataCommand(async = "AsyncWriteOnlyDataCommand"))) + async( + feature = "async", + idents(WriteOnlyDataCommand(async = "AsyncWriteOnlyDataCommand")) + ) )] pub trait DisplaySize { /// Width in pixels