Skip to content

Commit

Permalink
Add Sealed to serial::uart_impls::RegisterBlockImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty19106 committed May 11, 2023
1 parent 7e90edf commit 6063be0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/serial/uart_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ use crate::rcc::{self, Clocks};
pub(crate) use crate::pac::uart4::RegisterBlock as RegisterBlockUart;
pub(crate) use crate::pac::usart1::RegisterBlock as RegisterBlockUsart;

#[cfg(feature = "uart4")]
impl crate::Sealed for RegisterBlockUart { }
impl crate::Sealed for RegisterBlockUsart { }

// Implemented by all USART/UART instances
pub trait Instance: crate::Sealed + rcc::Enable + rcc::Reset + rcc::BusClock + CommonPins {
type RegisterBlock;
Expand All @@ -26,7 +30,7 @@ pub trait Instance: crate::Sealed + rcc::Enable + rcc::Reset + rcc::BusClock + C
fn set_stopbits(&self, bits: config::StopBits);
}

pub trait RegisterBlockImpl {
pub trait RegisterBlockImpl: crate::Sealed {
fn new<UART: Instance<RegisterBlock = Self>, WORD>(
uart: UART,
pins: (impl Into<UART::Tx<PushPull>>, impl Into<UART::Rx<PushPull>>),
Expand Down

0 comments on commit 6063be0

Please sign in to comment.