stm32 CORDIC: use private_bounds for sealed traits.

This commit is contained in:
eZio Pan 2024-03-23 09:04:09 +08:00
parent 0abcccee96
commit 8fa1d06a6a
2 changed files with 7 additions and 11 deletions

View file

@ -11,16 +11,11 @@ pub use enums::*;
mod errors; mod errors;
pub use errors::*; pub use errors::*;
mod sealed;
use self::sealed::SealedInstance;
pub mod utils; pub mod utils;
pub(crate) mod sealed;
/// Low-level CORDIC access.
#[cfg(feature = "unstable-pac")]
pub mod low_level {
pub use super::sealed::*;
}
/// CORDIC driver /// CORDIC driver
pub struct Cordic<'d, T: Instance> { pub struct Cordic<'d, T: Instance> {
peri: PeripheralRef<'d, T>, peri: PeripheralRef<'d, T>,
@ -28,7 +23,8 @@ pub struct Cordic<'d, T: Instance> {
} }
/// CORDIC instance trait /// CORDIC instance trait
pub trait Instance: sealed::Instance + Peripheral<P = Self> + crate::rcc::RccPeripheral {} #[allow(private_bounds)]
pub trait Instance: SealedInstance + Peripheral<P = Self> + crate::rcc::RccPeripheral {}
/// CORDIC configuration /// CORDIC configuration
#[derive(Debug)] #[derive(Debug)]
@ -609,7 +605,7 @@ foreach_interrupt!(
impl Instance for peripherals::$inst { impl Instance for peripherals::$inst {
} }
impl sealed::Instance for peripherals::$inst { impl SealedInstance for peripherals::$inst {
fn regs() -> crate::pac::cordic::Cordic { fn regs() -> crate::pac::cordic::Cordic {
crate::pac::$inst crate::pac::$inst
} }

View file

@ -2,7 +2,7 @@ use super::*;
use crate::pac::cordic::vals; use crate::pac::cordic::vals;
/// Cordic instance /// Cordic instance
pub trait Instance { pub(super) trait SealedInstance {
/// Get access to CORDIC registers /// Get access to CORDIC registers
fn regs() -> crate::pac::cordic::Cordic; fn regs() -> crate::pac::cordic::Cordic;