Update to use private supertrait, following PR#2730

This commit is contained in:
Karun 2024-04-02 16:14:10 -04:00
parent 9344f55ff3
commit 166c95be6c

View File

@ -12,8 +12,7 @@ pub use enums::*;
use stm32_metapac::octospi::vals::{PhaseMode, SizeInBits}; use stm32_metapac::octospi::vals::{PhaseMode, SizeInBits};
use crate::dma::{word, Transfer}; use crate::dma::{word, Transfer};
use crate::gpio::sealed::{AFType, Pin as _}; use crate::gpio::{AFType, AnyPin, Pull, SealedPin as _};
use crate::gpio::{AnyPin, Pull};
use crate::pac::octospi::{vals, Octospi as Regs}; use crate::pac::octospi::{vals, Octospi as Regs};
use crate::rcc::RccPeripheral; use crate::rcc::RccPeripheral;
use crate::{peripherals, Peripheral}; use crate::{peripherals, Peripheral};
@ -1002,20 +1001,17 @@ impl RegsExt for Regs {
} }
} }
pub(crate) mod sealed { pub(crate) trait SealedInstance {
use super::*; const REGS: Regs;
}
pub trait Instance { trait SealedWord {
const REGS: Regs; const CONFIG: word_impl::Config;
}
pub trait Word {
const CONFIG: word_impl::Config;
}
} }
/// OSPI instance trait. /// OSPI instance trait.
pub trait Instance: Peripheral<P = Self> + sealed::Instance + RccPeripheral {} #[allow(private_bounds)]
pub trait Instance: Peripheral<P = Self> + SealedInstance + RccPeripheral {}
pin_trait!(SckPin, Instance); pin_trait!(SckPin, Instance);
pin_trait!(NckPin, Instance); pin_trait!(NckPin, Instance);
@ -1033,7 +1029,7 @@ dma_trait!(OctoDma, Instance);
foreach_peripheral!( foreach_peripheral!(
(octospi, $inst:ident) => { (octospi, $inst:ident) => {
impl sealed::Instance for peripherals::$inst { impl SealedInstance for peripherals::$inst {
const REGS: Regs = crate::pac::$inst; const REGS: Regs = crate::pac::$inst;
} }
@ -1057,11 +1053,12 @@ impl<'d, T: Instance, Dma> GetConfig for Ospi<'d, T, Dma> {
} }
/// Word sizes usable for OSPI. /// Word sizes usable for OSPI.
pub trait Word: word::Word + sealed::Word {} #[allow(private_bounds)]
pub trait Word: word::Word + SealedWord {}
macro_rules! impl_word { macro_rules! impl_word {
($T:ty, $config:expr) => { ($T:ty, $config:expr) => {
impl sealed::Word for $T { impl SealedWord for $T {
const CONFIG: Config = $config; const CONFIG: Config = $config;
} }
impl Word for $T {} impl Word for $T {}