From bb5402ebdbee032ef83e089084e8c1431a6eff29 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 23 Sep 2024 11:47:40 +0200 Subject: [PATCH] API fixes --- va416xx-hal/src/uart.rs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/va416xx-hal/src/uart.rs b/va416xx-hal/src/uart.rs index b6c8908..6c64675 100644 --- a/va416xx-hal/src/uart.rs +++ b/va416xx-hal/src/uart.rs @@ -305,10 +305,14 @@ pub struct Uart { pins: Pins, } -/// Serial receiver +/// Serial receiver. +/// +/// Can be created by using the [Uart::split] or [UartBase::split] API. pub struct Rx(Uart); /// Serial transmitter +/// +/// Can be created by using the [Uart::split] or [UartBase::split] API. pub struct Tx(Uart); impl Rx { @@ -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 }