pub struct UartBackend<T> { /* private fields */ }Expand description
Passive UART backend adapter.
This type does not require std or heap allocation. The caller provides
time through now_ms arguments, usually from SysTick or an RTOS tick.
Implementations§
Source§impl<T> UartBackend<T>where
T: UartIo,
impl<T> UartBackend<T>where
T: UartIo,
Sourcepub fn with_config(io: T, config: EngineConfig) -> Self
pub fn with_config(io: T, config: EngineConfig) -> Self
Creates a backend adapter using config.
Sourcepub fn peer_state(&self) -> PeerState
pub fn peer_state(&self) -> PeerState
Returns the endpoint peer state.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the adapter and returns the UART IO object.
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Drops the active backend session.
Sourcepub fn send(&mut self, message: &[u8]) -> UartResult<bool, T::Error>
pub fn send(&mut self, message: &[u8]) -> UartResult<bool, T::Error>
Queues an application message.
Sourcepub fn receive_available(&mut self, now_ms: u64) -> UartResult<usize, T::Error>
pub fn receive_available(&mut self, now_ms: u64) -> UartResult<usize, T::Error>
Reads currently available UART bytes and feeds them into MSRT.
Sourcepub fn poll(&mut self, now_ms: u64) -> UartResult<UartBackendEvent, T::Error>
pub fn poll(&mut self, now_ms: u64) -> UartResult<UartBackendEvent, T::Error>
Polls one backend event and writes pending UART bytes.
Sourcepub fn tick(&mut self, now_ms: u64) -> UartResult<UartBackendEvent, T::Error>
pub fn tick(&mut self, now_ms: u64) -> UartResult<UartBackendEvent, T::Error>
Runs receive_available followed by poll.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for UartBackend<T>where
T: Freeze,
impl<T> RefUnwindSafe for UartBackend<T>where
T: RefUnwindSafe,
impl<T> Send for UartBackend<T>where
T: Send,
impl<T> Sync for UartBackend<T>where
T: Sync,
impl<T> Unpin for UartBackend<T>where
T: Unpin,
impl<T> UnsafeUnpin for UartBackend<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for UartBackend<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more