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"), } } 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, diff --git a/src/properties.rs b/src/properties.rs index c37b654..4352118 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(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)?; // TODO: Ability to turn charge pump on/off // Display must be off when performing this command Command::ChargePump(true).send(&mut self.iface)?; @@ -60,12 +62,13 @@ 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), }?; - 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)?;