aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32h735
diff options
context:
space:
mode:
authorDavid Haig <[email protected]>2024-06-28 18:17:17 +0100
committerDavid Haig <[email protected]>2024-06-28 18:17:17 +0100
commit6edf7b4688361e165c2ea9af03df9725a89a853e (patch)
treecf4246874ce4fe11ffe7798ba25407739958870f /examples/stm32h735
parent79f00e54cc4d13a28c7ccc9a13345bf2f3730f42 (diff)
Applied formatting
Diffstat (limited to 'examples/stm32h735')
-rw-r--r--examples/stm32h735/src/bin/ltdc.rs42
1 files changed, 18 insertions, 24 deletions
diff --git a/examples/stm32h735/src/bin/ltdc.rs b/examples/stm32h735/src/bin/ltdc.rs
index 5c75a7db1..a36fdef2c 100644
--- a/examples/stm32h735/src/bin/ltdc.rs
+++ b/examples/stm32h735/src/bin/ltdc.rs
@@ -11,22 +11,18 @@
11use bouncy_box::BouncyBox; 11use bouncy_box::BouncyBox;
12use defmt::{info, unwrap}; 12use defmt::{info, unwrap};
13use embassy_executor::Spawner; 13use embassy_executor::Spawner;
14use embassy_stm32::{ 14use embassy_stm32::gpio::{Level, Output, Speed};
15 bind_interrupts, 15use embassy_stm32::ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge};
16 gpio::{Level, Output, Speed}, 16use embassy_stm32::{bind_interrupts, peripherals};
17 ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge},
18 peripherals,
19};
20use embassy_time::{Duration, Timer}; 17use embassy_time::{Duration, Timer};
21use embedded_graphics::{ 18use embedded_graphics::draw_target::DrawTarget;
22 draw_target::DrawTarget, 19use embedded_graphics::geometry::{OriginDimensions, Point, Size};
23 geometry::{OriginDimensions, Point, Size}, 20use embedded_graphics::image::Image;
24 image::Image, 21use embedded_graphics::pixelcolor::raw::RawU24;
25 pixelcolor::{raw::RawU24, Rgb888}, 22use embedded_graphics::pixelcolor::Rgb888;
26 prelude::*, 23use embedded_graphics::prelude::*;
27 primitives::Rectangle, 24use embedded_graphics::primitives::Rectangle;
28 Pixel, 25use embedded_graphics::Pixel;
29};
30use heapless::{Entry, FnvIndexMap}; 26use heapless::{Entry, FnvIndexMap};
31use tinybmp::Bmp; 27use tinybmp::Bmp;
32use {defmt_rtt as _, panic_probe as _}; 28use {defmt_rtt as _, panic_probe as _};
@@ -100,7 +96,7 @@ async fn main(spawner: Spawner) {
100 96
101 // enable the bottom layer with a 256 color lookup table 97 // enable the bottom layer with a 256 color lookup table
102 ltdc.init_layer(&layer_config, Some(&clut)); 98 ltdc.init_layer(&layer_config, Some(&clut));
103 99
104 // Safety: the DoubleBuffer controls access to the statically allocated frame buffers 100 // Safety: the DoubleBuffer controls access to the statically allocated frame buffers
105 // and it is the only thing that mutates their content 101 // and it is the only thing that mutates their content
106 let mut double_buffer = DoubleBuffer::new( 102 let mut double_buffer = DoubleBuffer::new(
@@ -283,12 +279,9 @@ impl OriginDimensions for DoubleBuffer {
283 279
284mod rcc_setup { 280mod rcc_setup {
285 281
286 use embassy_stm32::{rcc::*, Peripherals}; 282 use embassy_stm32::rcc::{Hse, HseMode, *};
287 use embassy_stm32::{ 283 use embassy_stm32::time::Hertz;
288 rcc::{Hse, HseMode}, 284 use embassy_stm32::{Config, Peripherals};
289 time::Hertz,
290 Config,
291 };
292 285
293 /// Sets up clocks for the stm32h735g mcu 286 /// Sets up clocks for the stm32h735g mcu
294 /// change this if you plan to use a different microcontroller 287 /// change this if you plan to use a different microcontroller
@@ -359,12 +352,13 @@ mod rcc_setup {
359 config.rcc.apb2_pre = APBPrescaler::DIV2; 352 config.rcc.apb2_pre = APBPrescaler::DIV2;
360 config.rcc.apb3_pre = APBPrescaler::DIV2; 353 config.rcc.apb3_pre = APBPrescaler::DIV2;
361 config.rcc.apb4_pre = APBPrescaler::DIV2; 354 config.rcc.apb4_pre = APBPrescaler::DIV2;
362 embassy_stm32::init(config) 355 embassy_stm32::init(config)
363 } 356 }
364} 357}
365 358
366mod bouncy_box { 359mod bouncy_box {
367 use embedded_graphics::{geometry::Point, primitives::Rectangle}; 360 use embedded_graphics::geometry::Point;
361 use embedded_graphics::primitives::Rectangle;
368 362
369 enum Direction { 363 enum Direction {
370 DownLeft, 364 DownLeft,