implement embedded_io::ReadReady for Uart & UartRx (#1702)

* implement `embedded_io::ReadReady` for `Uart` & `UartRx`

* update CHANGELOG.md
This commit is contained in:
Felix Wirth 2024-06-21 18:01:40 +02:00 committed by GitHub
parent eee20de116
commit 9691141fed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View File

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add Flex / AnyFlex GPIO pin driver (#1659)
- Add new `DmaError::UnsupportedMemoryRegion` - used memory regions are checked when preparing a transfer now (#1670)
- Add DmaTransactionTxOwned, DmaTransactionRxOwned, DmaTransactionTxRxOwned, functions to do owning transfers added to SPI half-duplex (#1672)
- uart: Implement `embedded_io::ReadReady` for `Uart` and `UartRx` (#1702)
### Fixed

View File

@ -1662,6 +1662,28 @@ where
}
}
#[cfg(feature = "embedded-io")]
impl<T, M> embedded_io::ReadReady for Uart<'_, T, M>
where
T: Instance,
M: Mode,
{
fn read_ready(&mut self) -> Result<bool, Self::Error> {
self.rx.read_ready()
}
}
#[cfg(feature = "embedded-io")]
impl<T, M> embedded_io::ReadReady for UartRx<'_, T, M>
where
T: Instance,
M: Mode,
{
fn read_ready(&mut self) -> Result<bool, Self::Error> {
Ok(T::get_rx_fifo_count() > 0)
}
}
#[cfg(feature = "embedded-io")]
impl<T, M> embedded_io::Write for Uart<'_, T, M>
where