diff options
| author | David Haig <[email protected]> | 2024-06-28 18:17:17 +0100 |
|---|---|---|
| committer | David Haig <[email protected]> | 2024-06-28 18:17:17 +0100 |
| commit | 6edf7b4688361e165c2ea9af03df9725a89a853e (patch) | |
| tree | cf4246874ce4fe11ffe7798ba25407739958870f /examples | |
| parent | 79f00e54cc4d13a28c7ccc9a13345bf2f3730f42 (diff) | |
Applied formatting
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32h735/src/bin/ltdc.rs | 42 |
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 @@ | |||
| 11 | use bouncy_box::BouncyBox; | 11 | use bouncy_box::BouncyBox; |
| 12 | use defmt::{info, unwrap}; | 12 | use defmt::{info, unwrap}; |
| 13 | use embassy_executor::Spawner; | 13 | use embassy_executor::Spawner; |
| 14 | use embassy_stm32::{ | 14 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 15 | bind_interrupts, | 15 | use embassy_stm32::ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge}; |
| 16 | gpio::{Level, Output, Speed}, | 16 | use embassy_stm32::{bind_interrupts, peripherals}; |
| 17 | ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge}, | ||
| 18 | peripherals, | ||
| 19 | }; | ||
| 20 | use embassy_time::{Duration, Timer}; | 17 | use embassy_time::{Duration, Timer}; |
| 21 | use embedded_graphics::{ | 18 | use embedded_graphics::draw_target::DrawTarget; |
| 22 | draw_target::DrawTarget, | 19 | use embedded_graphics::geometry::{OriginDimensions, Point, Size}; |
| 23 | geometry::{OriginDimensions, Point, Size}, | 20 | use embedded_graphics::image::Image; |
| 24 | image::Image, | 21 | use embedded_graphics::pixelcolor::raw::RawU24; |
| 25 | pixelcolor::{raw::RawU24, Rgb888}, | 22 | use embedded_graphics::pixelcolor::Rgb888; |
| 26 | prelude::*, | 23 | use embedded_graphics::prelude::*; |
| 27 | primitives::Rectangle, | 24 | use embedded_graphics::primitives::Rectangle; |
| 28 | Pixel, | 25 | use embedded_graphics::Pixel; |
| 29 | }; | ||
| 30 | use heapless::{Entry, FnvIndexMap}; | 26 | use heapless::{Entry, FnvIndexMap}; |
| 31 | use tinybmp::Bmp; | 27 | use tinybmp::Bmp; |
| 32 | use {defmt_rtt as _, panic_probe as _}; | 28 | use {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 | ||
| 284 | mod rcc_setup { | 280 | mod 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 | ||
| 366 | mod bouncy_box { | 359 | mod 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, |
