From 58e4a3a211f61ded205465db7a59e9e7c3596022 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 23 Sep 2024 11:41:29 +0200 Subject: [PATCH] docs --- va416xx-hal/CHANGELOG.md | 3 +++ va416xx-hal/src/uart.rs | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/va416xx-hal/CHANGELOG.md b/va416xx-hal/CHANGELOG.md index fdcdbb0..42dce3f 100644 --- a/va416xx-hal/CHANGELOG.md +++ b/va416xx-hal/CHANGELOG.md @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Improve and fix SPI abstractions. Add new low level interface. The primary SPI constructor now only expects a configuration structure and the transfer configuration needs to be applied in a separate step. +- Added an additional way to read the UART RX with IRQs. The module documentation provides + more information. +- Made the UART with IRQ API more flexible for future additions. ## Fixed diff --git a/va416xx-hal/src/uart.rs b/va416xx-hal/src/uart.rs index df5d3e6..b6c8908 100644 --- a/va416xx-hal/src/uart.rs +++ b/va416xx-hal/src/uart.rs @@ -691,6 +691,19 @@ pub enum IrqError { /// Serial receiver, using interrupts to offload reading to the hardware. /// /// You can use [Rx::to_rx_with_irq] to convert a normal [Rx] structure into this structure. +/// This structure provides two distinct ways to read the UART RX using interrupts. It should +/// be noted that the interrupt service routine (ISR) still has to be provided by the user. However, +/// this structure provides API calls which can be used inside the ISRs to simplify the reading +/// of the UART. +/// +/// 1. The first way simply empties the FIFO on an interrupt into a user provided buffer. You +/// can simply use [Self::start] to prepare the peripheral and then call the +/// [Self::irq_handler] in the interrupt service routine. +/// 2. The second way reads packets bounded by a maximum size or a baudtick based timeout. You +/// can use [Self::read_fixed_len_or_timeout_based_using_irq] to prepare the peripheral and +/// then call the [Self::irq_handler_max_size_or_timeout_based] in the interrupt service +/// routine. You have to call [Self::read_fixed_len_or_timeout_based_using_irq] in the ISR to +/// start reading the next packet. pub struct RxWithIrq(Rx); impl RxWithIrq {