Skip to content

Commit

Permalink
API fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Sep 23, 2024
1 parent 58e4a3a commit bb5402e
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion va416xx-hal/src/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,14 @@ pub struct Uart<UartInstance, Pins> {
pins: Pins,
}

/// Serial receiver
/// Serial receiver.
///
/// Can be created by using the [Uart::split] or [UartBase::split] API.
pub struct Rx<Uart>(Uart);

/// Serial transmitter
///
/// Can be created by using the [Uart::split] or [UartBase::split] API.
pub struct Tx<Uart>(Uart);

impl<Uart: Instance> Rx<Uart> {
Expand Down Expand Up @@ -677,6 +681,29 @@ pub struct IrqUartError {
}

impl IrqUartError {
#[inline(always)]
pub fn overflow(&self) -> bool {
self.overflow
}

#[inline(always)]
pub fn framing(&self) -> bool {
self.framing
}

#[inline(always)]
pub fn parity(&self) -> bool {
self.parity
}

#[inline(always)]
pub fn other(&self) -> bool {
self.other
}
}

impl IrqUartError {
#[inline(always)]
pub fn error(&self) -> bool {
self.overflow || self.framing || self.parity
}
Expand Down

0 comments on commit bb5402e

Please sign in to comment.