From d111eceb4ba0094d34f58a4695bb3d43d188e591 Mon Sep 17 00:00:00 2001 From: Dion Dokter Date: Thu, 20 Nov 2025 14:16:43 +0100 Subject: Update LCD to modern embassy --- examples/stm32u0/Cargo.toml | 2 +- examples/stm32u0/src/bin/lcd.rs | 63 +++++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 31 deletions(-) (limited to 'examples') diff --git a/examples/stm32u0/Cargo.toml b/examples/stm32u0/Cargo.toml index 9f5227e3f..42d349cda 100644 --- a/examples/stm32u0/Cargo.toml +++ b/examples/stm32u0/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dependencies] # Change stm32u083rc to your chip name, if necessary. -embassy-stm32 = { version = "0.4.0", path = "../../embassy-stm32", features = [ "defmt", "time-driver-any", "stm32u083rc", "memory-x", "unstable-pac", "exti", "chrono"] } +embassy-stm32 = { version = "0.4.0", path = "../../embassy-stm32", features = [ "defmt", "time-driver-any", "stm32u083mc", "memory-x", "unstable-pac", "exti", "chrono"] } embassy-sync = { version = "0.7.2", path = "../../embassy-sync", features = ["defmt"] } embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } diff --git a/examples/stm32u0/src/bin/lcd.rs b/examples/stm32u0/src/bin/lcd.rs index 5551dd819..f27c4458b 100644 --- a/examples/stm32u0/src/bin/lcd.rs +++ b/examples/stm32u0/src/bin/lcd.rs @@ -3,7 +3,10 @@ use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::{lcd::{Bias, Config, Duty, Lcd, VoltageSource}, time::Hertz}; +use embassy_stm32::{ + lcd::{Bias, Config, Duty, Lcd, LcdPin}, + time::Hertz, +}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::main] @@ -31,41 +34,41 @@ async fn main(_spawner: Spawner) { let mut config = Config::default(); config.bias = Bias::Third; config.duty = Duty::Quarter; - config.target_fps = Hertz(60); + config.target_fps = Hertz(100); let mut lcd = Lcd::new( p.LCD, config, p.PC3, [ - p.PA8.into(), - p.PA9.into(), - p.PA10.into(), - p.PB1.into(), - p.PB9.into(), - p.PB11.into(), - p.PB14.into(), - p.PB15.into(), - p.PC4.into(), - p.PC5.into(), - p.PC6.into(), - p.PC8.into(), - p.PC9.into(), - p.PC10.into(), - p.PC11.into(), - p.PD8.into(), - p.PD9.into(), - p.PD12.into(), - p.PD13.into(), - p.PD0.into(), - p.PD1.into(), - p.PD3.into(), - p.PD4.into(), - p.PD5.into(), - p.PD6.into(), - p.PE7.into(), - p.PE8.into(), - p.PE9.into(), + LcdPin::from(p.PA8), + LcdPin::from(p.PA9), + LcdPin::from(p.PA10), + LcdPin::from(p.PB1), + LcdPin::from(p.PB9), + LcdPin::from(p.PB11), + LcdPin::from(p.PB14), + LcdPin::from(p.PB15), + LcdPin::from(p.PC4), + LcdPin::from(p.PC5), + LcdPin::from(p.PC6), + LcdPin::from(p.PC8), + LcdPin::from(p.PC9), + LcdPin::from(p.PC10), + LcdPin::from(p.PC11), + LcdPin::from(p.PD8), + LcdPin::from(p.PD9), + LcdPin::from(p.PD12), + LcdPin::from(p.PD13), + LcdPin::from(p.PD0), + LcdPin::from(p.PD1), + LcdPin::from(p.PD3), + LcdPin::from(p.PD4), + LcdPin::from(p.PD5), + LcdPin::from(p.PD6), + LcdPin::from(p.PE7), + LcdPin::from(p.PE8), + LcdPin::from(p.PE9), ], ); -- cgit