From 8bbb3881b7e909f64feb2b7da4d98ddca11b5e71 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 27 Jul 2021 03:15:59 +0100 Subject: [PATCH 1/9] Update command.rs --- src/command.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/command.rs b/src/command.rs index 06e1d47..0b21a31 100644 --- a/src/command.rs +++ b/src/command.rs @@ -106,6 +106,22 @@ pub enum Page { Page6 = 6, /// Page 7 Page7 = 7, + /// Page 8 + Page8 = 8, + /// Page 9 + Page9 = 9, + /// Page 10 + Page10 = 10, + /// Page 11 + Page11 = 11, + /// Page 12 + Page12 = 12, + /// Page 13 + Page13 = 13, + /// Page 14 + Page14 = 14, + /// Page 15 + Page15 = 15 } impl From for Page { @@ -119,6 +135,14 @@ impl From for Page { 5 => Page::Page5, 6 => Page::Page6, 7 => Page::Page7, + 8 => Page::Page8, + 9 => Page::Page9, + 10 => Page::Page10, + 11 => Page::Page11, + 12 => Page::Page12, + 13 => Page::Page13, + 14 => Page::Page14, + 15 => Page::Page15, _ => panic!("Page too high"), } } From b16fd1a949f24140ab2be13afc08a9c82c57d39b Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 27 Jul 2021 03:16:57 +0100 Subject: [PATCH 2/9] Update displaysize.rs --- src/displaysize.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/displaysize.rs b/src/displaysize.rs index 981639a..4fca3f7 100644 --- a/src/displaysize.rs +++ b/src/displaysize.rs @@ -3,6 +3,8 @@ /// Display size enumeration #[derive(Clone, Copy)] pub enum DisplaySize { + /// 128 by 128 pixels + Display128x128, /// 128 by 64 pixels Display128x64, /// 128 by 64 pixels without 2px X offset @@ -17,6 +19,7 @@ impl DisplaySize { /// Get integral dimensions from DisplaySize pub fn dimensions(self) -> (u8, u8) { match self { + DisplaySize::Display128x128 => (128, 128), DisplaySize::Display128x64 => (128, 64), DisplaySize::Display128x64NoOffset => (128, 64), DisplaySize::Display128x32 => (128, 32), @@ -27,6 +30,7 @@ impl DisplaySize { /// Get the panel column offset from DisplaySize pub fn column_offset(self) -> u8 { match self { + DisplaySize::Display128x128 => 2, DisplaySize::Display128x64 => 2, DisplaySize::Display128x64NoOffset => 0, DisplaySize::Display128x32 => 2, From 1b377dabf30737a8b11d4e0488f91d81756cddbb Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 27 Jul 2021 03:18:27 +0100 Subject: [PATCH 3/9] Update properties.rs --- src/properties.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/properties.rs b/src/properties.rs index c37b654..6d038a5 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -60,7 +60,8 @@ where match self.display_size { DisplaySize::Display128x32 => Command::ComPinConfig(false).send(&mut self.iface), - DisplaySize::Display128x64 + DisplaySize::Display128x128 + | DisplaySize::Display128x64 | DisplaySize::Display128x64NoOffset | DisplaySize::Display132x64 => Command::ComPinConfig(true).send(&mut self.iface), }?; From dd9ac8a71f6a1b8f5d4df66a778563c246b33fa1 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 27 Jul 2021 10:46:45 +0100 Subject: [PATCH 4/9] Update properties.rs --- src/properties.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/properties.rs b/src/properties.rs index 6d038a5..cfe9858 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -50,7 +50,7 @@ where Command::DisplayOn(false).send(&mut self.iface)?; Command::DisplayClockDiv(0x8, 0x0).send(&mut self.iface)?; Command::Multiplex(display_height - 1).send(&mut self.iface)?; - Command::DisplayOffset(0).send(&mut self.iface)?; + Command::DisplayOffset(0x60).send(&mut self.iface)?; Command::StartLine(0).send(&mut self.iface)?; // TODO: Ability to turn charge pump on/off // Display must be off when performing this command From 86f673ba0643160f04244bbe8a5faf0c0d5c4303 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 27 Jul 2021 10:47:03 +0100 Subject: [PATCH 5/9] Update i2c.rs --- src/interface/i2c.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface/i2c.rs b/src/interface/i2c.rs index 543cb3b..6b8e478 100644 --- a/src/interface/i2c.rs +++ b/src/interface/i2c.rs @@ -43,7 +43,7 @@ where fn send_data(&mut self, buf: &[u8]) -> Result<(), Self::Error> { // Display is always 128px wide - const CHUNKLEN: usize = 128; + const CHUNKLEN: usize = 64; const BUFLEN: usize = CHUNKLEN + 1; From 547feeab98e951ebf1bcba6d5426961217ce54ba Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 27 Jul 2021 10:48:16 +0100 Subject: [PATCH 6/9] Update i2c.rs --- src/interface/i2c.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface/i2c.rs b/src/interface/i2c.rs index 6b8e478..543cb3b 100644 --- a/src/interface/i2c.rs +++ b/src/interface/i2c.rs @@ -43,7 +43,7 @@ where fn send_data(&mut self, buf: &[u8]) -> Result<(), Self::Error> { // Display is always 128px wide - const CHUNKLEN: usize = 64; + const CHUNKLEN: usize = 128; const BUFLEN: usize = CHUNKLEN + 1; From a2aab8e6ed136311d1700a82911d1241f75502a4 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 28 Jul 2021 11:31:47 +0100 Subject: [PATCH 7/9] Update properties.rs --- src/properties.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/properties.rs b/src/properties.rs index cfe9858..6d038a5 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -50,7 +50,7 @@ where Command::DisplayOn(false).send(&mut self.iface)?; Command::DisplayClockDiv(0x8, 0x0).send(&mut self.iface)?; Command::Multiplex(display_height - 1).send(&mut self.iface)?; - Command::DisplayOffset(0x60).send(&mut self.iface)?; + Command::DisplayOffset(0).send(&mut self.iface)?; Command::StartLine(0).send(&mut self.iface)?; // TODO: Ability to turn charge pump on/off // Display must be off when performing this command From 645d7ac12b25e6c5fc68af69327f0e16224a6f0f Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 28 Jul 2021 12:27:54 +0100 Subject: [PATCH 8/9] Update properties.rs --- src/properties.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/properties.rs b/src/properties.rs index 6d038a5..28eed8f 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -48,10 +48,12 @@ where let display_rotation = self.display_rotation; Command::DisplayOn(false).send(&mut self.iface)?; - Command::DisplayClockDiv(0x8, 0x0).send(&mut self.iface)?; - Command::Multiplex(display_height - 1).send(&mut self.iface)?; - Command::DisplayOffset(0).send(&mut self.iface)?; Command::StartLine(0).send(&mut self.iface)?; + Command::Contrast(0x80).send(&mut self.iface)?; + Command::SegmentRemap(0x00).send(&mut self.iface)?; + Command::Multiplex(128).send(&mut self.iface)?; + Command::DisplayOffset(0x60).send(&mut self.iface)?; + Command::DisplayClockDiv(0x8, 0x0).send(&mut self.iface)?; // TODO: Ability to turn charge pump on/off // Display must be off when performing this command Command::ChargePump(true).send(&mut self.iface)?; @@ -66,7 +68,7 @@ where | DisplaySize::Display132x64 => Command::ComPinConfig(true).send(&mut self.iface), }?; - Command::Contrast(0x80).send(&mut self.iface)?; + Command::PreChargePeriod(0x1, 0xF).send(&mut self.iface)?; Command::VcomhDeselect(VcomhLevel::Auto).send(&mut self.iface)?; Command::AllOn(false).send(&mut self.iface)?; From c95e1c6757f04a6c3c21645605679a8f8e7f48cd Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 28 Jul 2021 12:28:32 +0100 Subject: [PATCH 9/9] Update properties.rs --- src/properties.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/properties.rs b/src/properties.rs index 28eed8f..4352118 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -50,7 +50,7 @@ where Command::DisplayOn(false).send(&mut self.iface)?; Command::StartLine(0).send(&mut self.iface)?; Command::Contrast(0x80).send(&mut self.iface)?; - Command::SegmentRemap(0x00).send(&mut self.iface)?; + Command::SegmentRemap(false).send(&mut self.iface)?; Command::Multiplex(128).send(&mut self.iface)?; Command::DisplayOffset(0x60).send(&mut self.iface)?; Command::DisplayClockDiv(0x8, 0x0).send(&mut self.iface)?;