aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/ltdc.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-03-26 16:01:37 +0100
committerDario Nieuwenhuis <[email protected]>2025-03-27 15:18:06 +0100
commitd41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch)
tree678b6fc732216e529dc38e6f65b72a309917ac32 /embassy-stm32/src/ltdc.rs
parent9edf5b7f049f95742b60b041e4443967d8a6b708 (diff)
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-stm32/src/ltdc.rs')
-rw-r--r--embassy-stm32/src/ltdc.rs68
1 files changed, 33 insertions, 35 deletions
diff --git a/embassy-stm32/src/ltdc.rs b/embassy-stm32/src/ltdc.rs
index 16210b7dc..0f6ef569c 100644
--- a/embassy-stm32/src/ltdc.rs
+++ b/embassy-stm32/src/ltdc.rs
@@ -6,7 +6,7 @@ use core::future::poll_fn;
6use core::marker::PhantomData; 6use core::marker::PhantomData;
7use core::task::Poll; 7use core::task::Poll;
8 8
9use embassy_hal_internal::{into_ref, PeripheralRef}; 9use embassy_hal_internal::PeripheralType;
10use embassy_sync::waitqueue::AtomicWaker; 10use embassy_sync::waitqueue::AtomicWaker;
11use stm32_metapac::ltdc::regs::Dccr; 11use stm32_metapac::ltdc::regs::Dccr;
12use stm32_metapac::ltdc::vals::{Bf1, Bf2, Cfuif, Clif, Crrif, Cterrif, Pf, Vbr}; 12use stm32_metapac::ltdc::vals::{Bf1, Bf2, Cfuif, Clif, Crrif, Cterrif, Pf, Vbr};
@@ -14,7 +14,7 @@ use stm32_metapac::ltdc::vals::{Bf1, Bf2, Cfuif, Clif, Crrif, Cterrif, Pf, Vbr};
14use crate::gpio::{AfType, OutputType, Speed}; 14use crate::gpio::{AfType, OutputType, Speed};
15use crate::interrupt::typelevel::Interrupt; 15use crate::interrupt::typelevel::Interrupt;
16use crate::interrupt::{self}; 16use crate::interrupt::{self};
17use crate::{peripherals, rcc, Peripheral}; 17use crate::{peripherals, rcc, Peri};
18 18
19static LTDC_WAKER: AtomicWaker = AtomicWaker::new(); 19static LTDC_WAKER: AtomicWaker = AtomicWaker::new();
20 20
@@ -83,7 +83,7 @@ pub enum PolarityActive {
83 83
84/// LTDC driver. 84/// LTDC driver.
85pub struct Ltdc<'d, T: Instance> { 85pub struct Ltdc<'d, T: Instance> {
86 _peri: PeripheralRef<'d, T>, 86 _peri: Peri<'d, T>,
87} 87}
88 88
89/// LTDC interrupt handler. 89/// LTDC interrupt handler.
@@ -178,47 +178,45 @@ impl<T: Instance> interrupt::typelevel::Handler<T::Interrupt> for InterruptHandl
178impl<'d, T: Instance> Ltdc<'d, T> { 178impl<'d, T: Instance> Ltdc<'d, T> {
179 // Create a new LTDC driver without specifying color and control pins. This is typically used if you want to drive a display though a DsiHost 179 // Create a new LTDC driver without specifying color and control pins. This is typically used if you want to drive a display though a DsiHost
180 /// Note: Full-Duplex modes are not supported at this time 180 /// Note: Full-Duplex modes are not supported at this time
181 pub fn new(peri: impl Peripheral<P = T> + 'd) -> Self { 181 pub fn new(peri: Peri<'d, T>) -> Self {
182 Self::setup_clocks(); 182 Self::setup_clocks();
183 into_ref!(peri);
184 Self { _peri: peri } 183 Self { _peri: peri }
185 } 184 }
186 185
187 /// Create a new LTDC driver. 8 pins per color channel for blue, green and red 186 /// Create a new LTDC driver. 8 pins per color channel for blue, green and red
188 #[allow(clippy::too_many_arguments)] 187 #[allow(clippy::too_many_arguments)]
189 pub fn new_with_pins( 188 pub fn new_with_pins(
190 peri: impl Peripheral<P = T> + 'd, 189 peri: Peri<'d, T>,
191 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, 190 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
192 clk: impl Peripheral<P = impl ClkPin<T>> + 'd, 191 clk: Peri<'d, impl ClkPin<T>>,
193 hsync: impl Peripheral<P = impl HsyncPin<T>> + 'd, 192 hsync: Peri<'d, impl HsyncPin<T>>,
194 vsync: impl Peripheral<P = impl VsyncPin<T>> + 'd, 193 vsync: Peri<'d, impl VsyncPin<T>>,
195 b0: impl Peripheral<P = impl B0Pin<T>> + 'd, 194 b0: Peri<'d, impl B0Pin<T>>,
196 b1: impl Peripheral<P = impl B1Pin<T>> + 'd, 195 b1: Peri<'d, impl B1Pin<T>>,
197 b2: impl Peripheral<P = impl B2Pin<T>> + 'd, 196 b2: Peri<'d, impl B2Pin<T>>,
198 b3: impl Peripheral<P = impl B3Pin<T>> + 'd, 197 b3: Peri<'d, impl B3Pin<T>>,
199 b4: impl Peripheral<P = impl B4Pin<T>> + 'd, 198 b4: Peri<'d, impl B4Pin<T>>,
200 b5: impl Peripheral<P = impl B5Pin<T>> + 'd, 199 b5: Peri<'d, impl B5Pin<T>>,
201 b6: impl Peripheral<P = impl B6Pin<T>> + 'd, 200 b6: Peri<'d, impl B6Pin<T>>,
202 b7: impl Peripheral<P = impl B7Pin<T>> + 'd, 201 b7: Peri<'d, impl B7Pin<T>>,
203 g0: impl Peripheral<P = impl G0Pin<T>> + 'd, 202 g0: Peri<'d, impl G0Pin<T>>,
204 g1: impl Peripheral<P = impl G1Pin<T>> + 'd, 203 g1: Peri<'d, impl G1Pin<T>>,
205 g2: impl Peripheral<P = impl G2Pin<T>> + 'd, 204 g2: Peri<'d, impl G2Pin<T>>,
206 g3: impl Peripheral<P = impl G3Pin<T>> + 'd, 205 g3: Peri<'d, impl G3Pin<T>>,
207 g4: impl Peripheral<P = impl G4Pin<T>> + 'd, 206 g4: Peri<'d, impl G4Pin<T>>,
208 g5: impl Peripheral<P = impl G5Pin<T>> + 'd, 207 g5: Peri<'d, impl G5Pin<T>>,
209 g6: impl Peripheral<P = impl G6Pin<T>> + 'd, 208 g6: Peri<'d, impl G6Pin<T>>,
210 g7: impl Peripheral<P = impl G7Pin<T>> + 'd, 209 g7: Peri<'d, impl G7Pin<T>>,
211 r0: impl Peripheral<P = impl R0Pin<T>> + 'd, 210 r0: Peri<'d, impl R0Pin<T>>,
212 r1: impl Peripheral<P = impl R1Pin<T>> + 'd, 211 r1: Peri<'d, impl R1Pin<T>>,
213 r2: impl Peripheral<P = impl R2Pin<T>> + 'd, 212 r2: Peri<'d, impl R2Pin<T>>,
214 r3: impl Peripheral<P = impl R3Pin<T>> + 'd, 213 r3: Peri<'d, impl R3Pin<T>>,
215 r4: impl Peripheral<P = impl R4Pin<T>> + 'd, 214 r4: Peri<'d, impl R4Pin<T>>,
216 r5: impl Peripheral<P = impl R5Pin<T>> + 'd, 215 r5: Peri<'d, impl R5Pin<T>>,
217 r6: impl Peripheral<P = impl R6Pin<T>> + 'd, 216 r6: Peri<'d, impl R6Pin<T>>,
218 r7: impl Peripheral<P = impl R7Pin<T>> + 'd, 217 r7: Peri<'d, impl R7Pin<T>>,
219 ) -> Self { 218 ) -> Self {
220 Self::setup_clocks(); 219 Self::setup_clocks();
221 into_ref!(peri);
222 new_pin!(clk, AfType::output(OutputType::PushPull, Speed::VeryHigh)); 220 new_pin!(clk, AfType::output(OutputType::PushPull, Speed::VeryHigh));
223 new_pin!(hsync, AfType::output(OutputType::PushPull, Speed::VeryHigh)); 221 new_pin!(hsync, AfType::output(OutputType::PushPull, Speed::VeryHigh));
224 new_pin!(vsync, AfType::output(OutputType::PushPull, Speed::VeryHigh)); 222 new_pin!(vsync, AfType::output(OutputType::PushPull, Speed::VeryHigh));
@@ -529,7 +527,7 @@ trait SealedInstance: crate::rcc::SealedRccPeripheral {
529 527
530/// LTDC instance trait. 528/// LTDC instance trait.
531#[allow(private_bounds)] 529#[allow(private_bounds)]
532pub trait Instance: SealedInstance + Peripheral<P = Self> + crate::rcc::RccPeripheral + 'static + Send { 530pub trait Instance: SealedInstance + PeripheralType + crate::rcc::RccPeripheral + 'static + Send {
533 /// Interrupt for this LTDC instance. 531 /// Interrupt for this LTDC instance.
534 type Interrupt: interrupt::typelevel::Interrupt; 532 type Interrupt: interrupt::typelevel::Interrupt;
535} 533}