From 8283fcdb91a559fe3a12cb01bc6523d737c28be8 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 13 Jun 2023 16:18:00 +0800 Subject: [PATCH 1/5] Update embedded-graphics to v0.8 Signed-off-by: Daniel Schaefer --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e3696c7..80b334b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ embedded-hal = "0.2" nb = "1.0" [dependencies.embedded-graphics] -version = "0.7" +version = "0.8" optional = true [features] From bca3f1cbc6e99430bcafa156bc1bfb19d07adaf3 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 27 Aug 2023 15:21:27 +0800 Subject: [PATCH 2/5] Update to embedded-hal 1.0 (alpha) Preparation for the full release. Signed-off-by: Daniel Schaefer --- Cargo.toml | 4 ++-- src/lib.rs | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 80b334b..103462b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,8 @@ keywords = ["st7306", "display", "embedded-graphics", "no-std"] categories = ["no-std", "no-std::no-alloc", "embedded"] [dependencies] -embedded-hal = "0.2" -nb = "1.0" +embedded-hal = "1.0.0-alpha.11" +nb = "1.1" [dependencies.embedded-graphics] version = "0.8" diff --git a/src/lib.rs b/src/lib.rs index 20de271..7698003 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,9 +17,9 @@ pub mod instruction; use crate::instruction::Instruction; -use embedded_hal::blocking::delay::DelayMs; -use embedded_hal::blocking::spi; -use embedded_hal::digital::v2::OutputPin; +use embedded_hal::delay::DelayUs; +use embedded_hal::digital::OutputPin; +use embedded_hal::spi::SpiDevice; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum PowerMode { @@ -99,7 +99,6 @@ impl FpsConfig { /// ST7306 driver to connect to TFT displays. pub struct ST7306 where - SPI: spi::Write, DC: OutputPin, CS: OutputPin, RST: OutputPin, @@ -158,7 +157,7 @@ pub enum Orientation { impl ST7306 where - SPI: spi::Write, + SPI: SpiDevice, DC: OutputPin, CS: OutputPin, RST: OutputPin, @@ -309,7 +308,7 @@ where /// Runs commands to initialize the display. pub fn init(&mut self, delay: &mut DELAY) -> Result<(), ()> where - DELAY: DelayMs, + DELAY: DelayUs, { // First do a hard reset because the controller might be in a bad state // if the voltage was unstable in the beginning. @@ -463,7 +462,7 @@ where /// if you want to be in LPM, need to manually go into LPM again. pub fn sleep_in(&mut self, delay: &mut DELAY) -> Result<(), ()> where - DELAY: DelayMs, + DELAY: DelayUs, { match self.power_mode { PowerMode::Hpm => { @@ -483,7 +482,7 @@ where /// Wake the controller from sleep pub fn sleep_out(&mut self, delay: &mut DELAY) -> Result<(), ()> where - DELAY: DelayMs, + DELAY: DelayUs, { self.write_command(Instruction::SLPOUT, &[])?; delay.delay_ms(100); @@ -498,7 +497,7 @@ where target_mode: PowerMode, ) -> Result<(), ()> where - DELAY: DelayMs, + DELAY: DelayUs, { if target_mode == self.power_mode { return Ok(()); @@ -541,7 +540,7 @@ where /// Hard reset the controller by toggling the reset pin fn hard_reset(&mut self, delay: &mut DELAY) -> Result<(), ()> where - DELAY: DelayMs, + DELAY: DelayUs, { self.rst.set_high().map_err(|_| ())?; delay.delay_ms(10); @@ -707,7 +706,7 @@ fn col_to_bright(color: Rgb565) -> u8 { impl DrawTarget for ST7306 where - SPI: spi::Write, + SPI: SpiDevice, DC: OutputPin, CS: OutputPin, RST: OutputPin, @@ -782,7 +781,7 @@ where impl OriginDimensions for ST7306 where - SPI: spi::Write, + SPI: SpiDevice, DC: OutputPin, CS: OutputPin, RST: OutputPin, From 9a18974c6c8e414f1ad441dcf78455d012396905 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 27 Aug 2023 15:26:45 +0800 Subject: [PATCH 3/5] Fix clippy lints See: https://rust-lang.github.io/rust-clippy/master/index.html#manual_try_fold Signed-off-by: Daniel Schaefer --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7698003..e88c6a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -579,9 +579,9 @@ where /// /// Either the command ID or the parameters. fn write_command_data(&mut self, data: &[u8]) -> Result<(), ()> { - data.iter().fold(Ok(()), |res, byte| { + data.iter().try_fold((), |res, byte| { self.spi.write(&[*byte]).map_err(|_| ())?; - res + Ok(res) }) } @@ -593,11 +593,11 @@ where /// Must always write to RAM in 24 bit sequences, that's why the data /// parameter accepts a slice of u8 triples. pub fn write_ram(&mut self, data: &[(u8, u8, u8)]) -> Result<(), ()> { - data.iter().fold(Ok(()), |res, (first, second, third)| { + data.iter().try_fold((), |res, (first, second, third)| { self.spi.write(&[*first]).map_err(|_| ())?; self.spi.write(&[*second]).map_err(|_| ())?; self.spi.write(&[*third]).map_err(|_| ())?; - res + Ok(res) }) } From fe971deb90c15d9bcd2196a9ff73b8bfb5598565 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 19 Jan 2026 00:13:09 +0800 Subject: [PATCH 4/5] Update to embedded-hal 1.0 Signed-off-by: Daniel Schaefer --- Cargo.toml | 2 +- src/lib.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 103462b..8439b34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ keywords = ["st7306", "display", "embedded-graphics", "no-std"] categories = ["no-std", "no-std::no-alloc", "embedded"] [dependencies] -embedded-hal = "1.0.0-alpha.11" +embedded-hal = "1.0" nb = "1.1" [dependencies.embedded-graphics] diff --git a/src/lib.rs b/src/lib.rs index e88c6a4..96b1f48 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ pub mod instruction; use crate::instruction::Instruction; -use embedded_hal::delay::DelayUs; +use embedded_hal::delay::DelayNs; use embedded_hal::digital::OutputPin; use embedded_hal::spi::SpiDevice; @@ -308,7 +308,7 @@ where /// Runs commands to initialize the display. pub fn init(&mut self, delay: &mut DELAY) -> Result<(), ()> where - DELAY: DelayUs, + DELAY: DelayNs, { // First do a hard reset because the controller might be in a bad state // if the voltage was unstable in the beginning. @@ -462,7 +462,7 @@ where /// if you want to be in LPM, need to manually go into LPM again. pub fn sleep_in(&mut self, delay: &mut DELAY) -> Result<(), ()> where - DELAY: DelayUs, + DELAY: DelayNs, { match self.power_mode { PowerMode::Hpm => { @@ -482,7 +482,7 @@ where /// Wake the controller from sleep pub fn sleep_out(&mut self, delay: &mut DELAY) -> Result<(), ()> where - DELAY: DelayUs, + DELAY: DelayNs, { self.write_command(Instruction::SLPOUT, &[])?; delay.delay_ms(100); @@ -497,7 +497,7 @@ where target_mode: PowerMode, ) -> Result<(), ()> where - DELAY: DelayUs, + DELAY: DelayNs, { if target_mode == self.power_mode { return Ok(()); @@ -540,7 +540,7 @@ where /// Hard reset the controller by toggling the reset pin fn hard_reset(&mut self, delay: &mut DELAY) -> Result<(), ()> where - DELAY: DelayUs, + DELAY: DelayNs, { self.rst.set_high().map_err(|_| ())?; delay.delay_ms(10); From 0b0c4b58c6c1a02e875dcb0b04510ddcba8dd3fc Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 19 Jan 2026 00:14:40 +0800 Subject: [PATCH 5/5] Bump version to 0.9.0 Signed-off-by: Daniel Schaefer --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 8439b34..181f9c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "st7306" description = "ST7306 TFT LCD driver with embedded-graphics support" -version = "0.8.2" +version = "0.9.0" authors = ["Daniel Schaefer "] edition = "2021" license = "MIT"