diff options
| author | Karun <[email protected]> | 2024-04-02 16:14:10 -0400 |
|---|---|---|
| committer | Karun <[email protected]> | 2024-04-02 16:14:10 -0400 |
| commit | 166c95be6c2917e5133fa361ee88d845a6f4ef73 (patch) | |
| tree | 2661b632506a6e84f842420dfb2caaf620688f31 | |
| parent | 9344f55ff3107917ce1b765bc4fa57965ec86ca6 (diff) | |
Update to use private supertrait, following PR#2730
| -rw-r--r-- | embassy-stm32/src/ospi/mod.rs | 27 |
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::*; | |||
| 12 | use stm32_metapac::octospi::vals::{PhaseMode, SizeInBits}; | 12 | use stm32_metapac::octospi::vals::{PhaseMode, SizeInBits}; |
| 13 | 13 | ||
| 14 | use crate::dma::{word, Transfer}; | 14 | use crate::dma::{word, Transfer}; |
| 15 | use crate::gpio::sealed::{AFType, Pin as _}; | 15 | use crate::gpio::{AFType, AnyPin, Pull, SealedPin as _}; |
| 16 | use crate::gpio::{AnyPin, Pull}; | ||
| 17 | use crate::pac::octospi::{vals, Octospi as Regs}; | 16 | use crate::pac::octospi::{vals, Octospi as Regs}; |
| 18 | use crate::rcc::RccPeripheral; | 17 | use crate::rcc::RccPeripheral; |
| 19 | use crate::{peripherals, Peripheral}; | 18 | use crate::{peripherals, Peripheral}; |
| @@ -1002,20 +1001,17 @@ impl RegsExt for Regs { | |||
| 1002 | } | 1001 | } |
| 1003 | } | 1002 | } |
| 1004 | 1003 | ||
| 1005 | pub(crate) mod sealed { | 1004 | pub(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 { | 1008 | trait 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. |
| 1018 | pub trait Instance: Peripheral<P = Self> + sealed::Instance + RccPeripheral {} | 1013 | #[allow(private_bounds)] |
| 1014 | pub trait Instance: Peripheral<P = Self> + SealedInstance + RccPeripheral {} | ||
| 1019 | 1015 | ||
| 1020 | pin_trait!(SckPin, Instance); | 1016 | pin_trait!(SckPin, Instance); |
| 1021 | pin_trait!(NckPin, Instance); | 1017 | pin_trait!(NckPin, Instance); |
| @@ -1033,7 +1029,7 @@ dma_trait!(OctoDma, Instance); | |||
| 1033 | 1029 | ||
| 1034 | foreach_peripheral!( | 1030 | foreach_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. |
| 1060 | pub trait Word: word::Word + sealed::Word {} | 1056 | #[allow(private_bounds)] |
| 1057 | pub trait Word: word::Word + SealedWord {} | ||
| 1061 | 1058 | ||
| 1062 | macro_rules! impl_word { | 1059 | macro_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 {} |
