Skip to content

Commit

Permalink
make usart::State private
Browse files Browse the repository at this point in the history
  • Loading branch information
ExplodingWaffle authored and Dirbaio committed Jan 19, 2024
1 parent 870da00 commit d781e23
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions embassy-stm32/src/usart/buffered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,25 @@ impl<T: BasicInstance> interrupt::typelevel::Handler<T::Interrupt> for Interrupt
}
}

/// Buffered UART State
pub struct State {
rx_waker: AtomicWaker,
rx_buf: RingBuffer,

tx_waker: AtomicWaker,
tx_buf: RingBuffer,
}

impl State {
/// Create new state
pub const fn new() -> Self {
Self {
rx_buf: RingBuffer::new(),
tx_buf: RingBuffer::new(),
rx_waker: AtomicWaker::new(),
tx_waker: AtomicWaker::new(),
pub(crate) use sealed::State;
pub(crate) mod sealed {
use super::*;
pub struct State {
pub(crate) rx_waker: AtomicWaker,
pub(crate) rx_buf: RingBuffer,
pub(crate) tx_waker: AtomicWaker,
pub(crate) tx_buf: RingBuffer,
}

impl State {
/// Create new state
pub const fn new() -> Self {
Self {
rx_buf: RingBuffer::new(),
tx_buf: RingBuffer::new(),
rx_waker: AtomicWaker::new(),
tx_waker: AtomicWaker::new(),
}
}
}
}
Expand Down

0 comments on commit d781e23

Please sign in to comment.