Applied formatting

This commit is contained in:
David Haig 2024-06-28 18:17:17 +01:00
parent 79f00e54cc
commit 6edf7b4688
2 changed files with 29 additions and 34 deletions

View file

@ -2,18 +2,19 @@
//! See ST application note AN4861: Introduction to LCD-TFT display controller (LTDC) on STM32 MCUs for high level details //! See ST application note AN4861: Introduction to LCD-TFT display controller (LTDC) on STM32 MCUs for high level details
//! This module was tested against the stm32h735g-dk using the RM0468 ST reference manual for detailed register information //! This module was tested against the stm32h735g-dk using the RM0468 ST reference manual for detailed register information
use crate::{ use core::future::poll_fn;
gpio::{AfType, OutputType, Speed}, use core::marker::PhantomData;
interrupt::{self, typelevel::Interrupt}, use core::task::Poll;
peripherals, rcc, Peripheral,
};
use core::{future::poll_fn, marker::PhantomData, task::Poll};
use embassy_hal_internal::{into_ref, PeripheralRef}; use embassy_hal_internal::{into_ref, PeripheralRef};
use embassy_sync::waitqueue::AtomicWaker; use embassy_sync::waitqueue::AtomicWaker;
use stm32_metapac::ltdc::{ use stm32_metapac::ltdc::regs::Dccr;
regs::Dccr, use stm32_metapac::ltdc::vals::{Bf1, Bf2, Cfuif, Clif, Crrif, Cterrif, Pf, Vbr};
vals::{Bf1, Bf2, Cfuif, Clif, Crrif, Cterrif, Pf, Vbr},
}; use crate::gpio::{AfType, OutputType, Speed};
use crate::interrupt::typelevel::Interrupt;
use crate::interrupt::{self};
use crate::{peripherals, rcc, Peripheral};
static LTDC_WAKER: AtomicWaker = AtomicWaker::new(); static LTDC_WAKER: AtomicWaker = AtomicWaker::new();

View file

@ -11,22 +11,18 @@
use bouncy_box::BouncyBox; use bouncy_box::BouncyBox;
use defmt::{info, unwrap}; use defmt::{info, unwrap};
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::{ use embassy_stm32::gpio::{Level, Output, Speed};
bind_interrupts, use embassy_stm32::ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge};
gpio::{Level, Output, Speed}, use embassy_stm32::{bind_interrupts, peripherals};
ltdc::{self, Ltdc, LtdcConfiguration, LtdcLayer, LtdcLayerConfig, PolarityActive, PolarityEdge},
peripherals,
};
use embassy_time::{Duration, Timer}; use embassy_time::{Duration, Timer};
use embedded_graphics::{ use embedded_graphics::draw_target::DrawTarget;
draw_target::DrawTarget, use embedded_graphics::geometry::{OriginDimensions, Point, Size};
geometry::{OriginDimensions, Point, Size}, use embedded_graphics::image::Image;
image::Image, use embedded_graphics::pixelcolor::raw::RawU24;
pixelcolor::{raw::RawU24, Rgb888}, use embedded_graphics::pixelcolor::Rgb888;
prelude::*, use embedded_graphics::prelude::*;
primitives::Rectangle, use embedded_graphics::primitives::Rectangle;
Pixel, use embedded_graphics::Pixel;
};
use heapless::{Entry, FnvIndexMap}; use heapless::{Entry, FnvIndexMap};
use tinybmp::Bmp; use tinybmp::Bmp;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
@ -100,7 +96,7 @@ async fn main(spawner: Spawner) {
// enable the bottom layer with a 256 color lookup table // enable the bottom layer with a 256 color lookup table
ltdc.init_layer(&layer_config, Some(&clut)); ltdc.init_layer(&layer_config, Some(&clut));
// Safety: the DoubleBuffer controls access to the statically allocated frame buffers // Safety: the DoubleBuffer controls access to the statically allocated frame buffers
// and it is the only thing that mutates their content // and it is the only thing that mutates their content
let mut double_buffer = DoubleBuffer::new( let mut double_buffer = DoubleBuffer::new(
@ -283,12 +279,9 @@ impl OriginDimensions for DoubleBuffer {
mod rcc_setup { mod rcc_setup {
use embassy_stm32::{rcc::*, Peripherals}; use embassy_stm32::rcc::{Hse, HseMode, *};
use embassy_stm32::{ use embassy_stm32::time::Hertz;
rcc::{Hse, HseMode}, use embassy_stm32::{Config, Peripherals};
time::Hertz,
Config,
};
/// Sets up clocks for the stm32h735g mcu /// Sets up clocks for the stm32h735g mcu
/// change this if you plan to use a different microcontroller /// change this if you plan to use a different microcontroller
@ -359,12 +352,13 @@ mod rcc_setup {
config.rcc.apb2_pre = APBPrescaler::DIV2; config.rcc.apb2_pre = APBPrescaler::DIV2;
config.rcc.apb3_pre = APBPrescaler::DIV2; config.rcc.apb3_pre = APBPrescaler::DIV2;
config.rcc.apb4_pre = APBPrescaler::DIV2; config.rcc.apb4_pre = APBPrescaler::DIV2;
embassy_stm32::init(config) embassy_stm32::init(config)
} }
} }
mod bouncy_box { mod bouncy_box {
use embedded_graphics::{geometry::Point, primitives::Rectangle}; use embedded_graphics::geometry::Point;
use embedded_graphics::primitives::Rectangle;
enum Direction { enum Direction {
DownLeft, DownLeft,