aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarun <[email protected]>2024-04-02 16:14:10 -0400
committerKarun <[email protected]>2024-04-02 16:14:10 -0400
commit166c95be6c2917e5133fa361ee88d845a6f4ef73 (patch)
tree2661b632506a6e84f842420dfb2caaf620688f31
parent9344f55ff3107917ce1b765bc4fa57965ec86ca6 (diff)
Update to use private supertrait, following PR#2730
-rw-r--r--embassy-stm32/src/ospi/mod.rs27
1 files changed, 12 insertions, 15 deletions
diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs
index 794bdd127..f85f07fc4 100644
--- a/embassy-stm32/src/ospi/mod.rs
+++ b/embassy-stm32/src/ospi/mod.rs
@@ -12,8 +12,7 @@ pub use enums::*;
12use stm32_metapac::octospi::vals::{PhaseMode, SizeInBits}; 12use stm32_metapac::octospi::vals::{PhaseMode, SizeInBits};
13 13
14use crate::dma::{word, Transfer}; 14use crate::dma::{word, Transfer};
15use crate::gpio::sealed::{AFType, Pin as _}; 15use crate::gpio::{AFType, AnyPin, Pull, SealedPin as _};
16use crate::gpio::{AnyPin, Pull};
17use crate::pac::octospi::{vals, Octospi as Regs}; 16use crate::pac::octospi::{vals, Octospi as Regs};
18use crate::rcc::RccPeripheral; 17use crate::rcc::RccPeripheral;
19use crate::{peripherals, Peripheral}; 18use crate::{peripherals, Peripheral};
@@ -1002,20 +1001,17 @@ impl RegsExt for Regs {
1002 } 1001 }
1003} 1002}
1004 1003
1005pub(crate) mod sealed { 1004pub(crate) trait SealedInstance {
1006 use super::*; 1005 const REGS: Regs;
1007 1006}
1008 pub trait Instance {
1009 const REGS: Regs;
1010 }
1011 1007
1012 pub trait Word { 1008trait SealedWord {
1013 const CONFIG: word_impl::Config; 1009 const CONFIG: word_impl::Config;
1014 }
1015} 1010}
1016 1011
1017/// OSPI instance trait. 1012/// OSPI instance trait.
1018pub trait Instance: Peripheral<P = Self> + sealed::Instance + RccPeripheral {} 1013#[allow(private_bounds)]
1014pub trait Instance: Peripheral<P = Self> + SealedInstance + RccPeripheral {}
1019 1015
1020pin_trait!(SckPin, Instance); 1016pin_trait!(SckPin, Instance);
1021pin_trait!(NckPin, Instance); 1017pin_trait!(NckPin, Instance);
@@ -1033,7 +1029,7 @@ dma_trait!(OctoDma, Instance);
1033 1029
1034foreach_peripheral!( 1030foreach_peripheral!(
1035 (octospi, $inst:ident) => { 1031 (octospi, $inst:ident) => {
1036 impl sealed::Instance for peripherals::$inst { 1032 impl SealedInstance for peripherals::$inst {
1037 const REGS: Regs = crate::pac::$inst; 1033 const REGS: Regs = crate::pac::$inst;
1038 } 1034 }
1039 1035
@@ -1057,11 +1053,12 @@ impl<'d, T: Instance, Dma> GetConfig for Ospi<'d, T, Dma> {
1057} 1053}
1058 1054
1059/// Word sizes usable for OSPI. 1055/// Word sizes usable for OSPI.
1060pub trait Word: word::Word + sealed::Word {} 1056#[allow(private_bounds)]
1057pub trait Word: word::Word + SealedWord {}
1061 1058
1062macro_rules! impl_word { 1059macro_rules! impl_word {
1063 ($T:ty, $config:expr) => { 1060 ($T:ty, $config:expr) => {
1064 impl sealed::Word for $T { 1061 impl SealedWord for $T {
1065 const CONFIG: Config = $config; 1062 const CONFIG: Config = $config;
1066 } 1063 }
1067 impl Word for $T {} 1064 impl Word for $T {}