From c34f15e3cfaa3e923a0fbe828b8576ef299f86c0 Mon Sep 17 00:00:00 2001 From: HenryLiang Date: Mon, 16 Dec 2024 09:46:47 +0800 Subject: [PATCH 1/2] Let the i2c support be released, so that other devices on this i2C can be called --- src/interface/i2c.rs | 5 +++++ src/properties.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/interface/i2c.rs b/src/interface/i2c.rs index 543cb3b..f3a0fa0 100644 --- a/src/interface/i2c.rs +++ b/src/interface/i2c.rs @@ -19,6 +19,11 @@ where pub fn new(i2c: I2C, addr: u8) -> Self { Self { i2c, addr } } + + /// Release i2c + pub fn release(self) -> I2C { + self.i2c + } } impl DisplayInterface for I2cInterface diff --git a/src/properties.rs b/src/properties.rs index c37b654..87be25b 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -167,4 +167,9 @@ where pub fn set_contrast(&mut self, contrast: u8) -> Result<(), DI::Error> { Command::Contrast(contrast).send(&mut self.iface) } + + /// Release iface + pub fn release(self) -> DI { + self.iface + } } From 9d1eb72a3ea6202f58fee2e76b0f19af4e5070c0 Mon Sep 17 00:00:00 2001 From: HenryLiang Date: Wed, 18 Dec 2024 11:16:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=B3=E6=9C=BA?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/properties.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/properties.rs b/src/properties.rs index 87be25b..9e96336 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -75,6 +75,11 @@ where Ok(()) } + /// Set Display Off + pub fn off(&mut self) -> Result<(), DI::Error> { + Command::DisplayOn(false).send(&mut self.iface) + } + /// Set the position in the framebuffer of the display where any sent data should be /// drawn. This method can be used for changing the affected area on the screen as well /// as (re-)setting the start point of the next `draw` call.