aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32u0
diff options
context:
space:
mode:
authorDion Dokter <[email protected]>2024-06-15 13:51:16 +0200
committerDion Dokter <[email protected]>2024-06-15 13:51:16 +0200
commit663732d85abbae400f2dbab2c411802a5b60e9b1 (patch)
tree2cafc4f119003b6e244cc67f0e35a616de5a885c /examples/stm32u0
parent10a1a19e9470b96664f94cb9fc3aa53ea51695a4 (diff)
Things work!
Diffstat (limited to 'examples/stm32u0')
-rw-r--r--examples/stm32u0/src/bin/lcd.rs39
1 files changed, 23 insertions, 16 deletions
diff --git a/examples/stm32u0/src/bin/lcd.rs b/examples/stm32u0/src/bin/lcd.rs
index 7a7c3a8a1..5551dd819 100644
--- a/examples/stm32u0/src/bin/lcd.rs
+++ b/examples/stm32u0/src/bin/lcd.rs
@@ -3,7 +3,7 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::lcd::{Bias, Config, Duty, Lcd, VoltageSource}; 6use embassy_stm32::{lcd::{Bias, Config, Duty, Lcd, VoltageSource}, time::Hertz};
7use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
8 8
9#[embassy_executor::main] 9#[embassy_executor::main]
@@ -22,7 +22,7 @@ async fn main(_spawner: Spawner) {
22 divq: None, 22 divq: None,
23 divr: Some(PllRDiv::DIV2), // 112 / 2 = 56 MHz 23 divr: Some(PllRDiv::DIV2), // 112 / 2 = 56 MHz
24 }); 24 });
25 config.rcc.ls = LsConfig::default_lse(); 25 config.rcc.ls = LsConfig::default_lsi();
26 } 26 }
27 27
28 let p = embassy_stm32::init(config); 28 let p = embassy_stm32::init(config);
@@ -31,46 +31,53 @@ async fn main(_spawner: Spawner) {
31 let mut config = Config::default(); 31 let mut config = Config::default();
32 config.bias = Bias::Third; 32 config.bias = Bias::Third;
33 config.duty = Duty::Quarter; 33 config.duty = Duty::Quarter;
34 config.target_fps = Hertz(60);
34 35
35 let mut lcd = Lcd::new( 36 let mut lcd = Lcd::new(
36 p.LCD, 37 p.LCD,
37 config, 38 config,
39 p.PC3,
38 [ 40 [
39 p.PC4.into(), 41 p.PA8.into(),
40 p.PC5.into(), 42 p.PA9.into(),
43 p.PA10.into(),
41 p.PB1.into(), 44 p.PB1.into(),
42 p.PE7.into(), 45 p.PB9.into(),
43 p.PE8.into(),
44 p.PE9.into(),
45 p.PB11.into(), 46 p.PB11.into(),
46 p.PB14.into(), 47 p.PB14.into(),
47 p.PB15.into(), 48 p.PB15.into(),
48 p.PD8.into(), 49 p.PC4.into(),
49 p.PD9.into(), 50 p.PC5.into(),
50 p.PD12.into(),
51 p.PB9.into(),
52 p.PA10.into(),
53 p.PA9.into(),
54 p.PA8.into(),
55 p.PD13.into(),
56 p.PC6.into(), 51 p.PC6.into(),
57 p.PC8.into(), 52 p.PC8.into(),
58 p.PC9.into(), 53 p.PC9.into(),
59 p.PC10.into(), 54 p.PC10.into(),
55 p.PC11.into(),
56 p.PD8.into(),
57 p.PD9.into(),
58 p.PD12.into(),
59 p.PD13.into(),
60 p.PD0.into(), 60 p.PD0.into(),
61 p.PD1.into(), 61 p.PD1.into(),
62 p.PD3.into(), 62 p.PD3.into(),
63 p.PD4.into(), 63 p.PD4.into(),
64 p.PD5.into(), 64 p.PD5.into(),
65 p.PD6.into(), 65 p.PD6.into(),
66 p.PC11.into(), 66 p.PE7.into(),
67 p.PE8.into(),
68 p.PE9.into(),
67 ], 69 ],
68 ); 70 );
69 71
70 loop { 72 loop {
71 defmt::info!("Writing frame"); 73 defmt::info!("Writing frame");
72 lcd.write_frame(&[0xAAAAAAAA; 16]); 74 lcd.write_frame(&[0xAAAAAAAA; 16]);
75
76 embassy_time::Timer::after_secs(1).await;
77
73 defmt::info!("Writing frame"); 78 defmt::info!("Writing frame");
74 lcd.write_frame(&[!0xAAAAAAAA; 16]); 79 lcd.write_frame(&[!0xAAAAAAAA; 16]);
80
81 embassy_time::Timer::after_secs(1).await;
75 } 82 }
76} 83}