mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
stm
This commit is contained in:
parent
08f1454527
commit
c7f775dc20
@ -436,6 +436,12 @@ impl<'d> BufferedUartRx<'d> {
|
||||
}
|
||||
}
|
||||
|
||||
/// we are ready to read if there is data in the buffer
|
||||
fn read_ready() -> Result<bool, Error> {
|
||||
let state = T::buffered_state();
|
||||
Ok(!state.rx_buf.is_empty())
|
||||
}
|
||||
|
||||
/// Reconfigure the driver
|
||||
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
|
||||
reconfigure(self.info, self.kernel_clock, config)?;
|
||||
@ -610,6 +616,18 @@ impl<'d> embedded_io_async::Read for BufferedUartRx<'d> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d> embedded_io_async::ReadReady for BufferedUart<'d> {
|
||||
fn read_ready(&mut self) -> Result<bool, Self::Error> {
|
||||
BufferedUartRx::<'d>::read_ready()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d> embedded_io_async::ReadReady for BufferedUartRx<'d> {
|
||||
fn read_ready(&mut self) -> Result<bool, Self::Error> {
|
||||
Self::read_ready()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d> embedded_io_async::BufRead for BufferedUart<'d> {
|
||||
async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
|
||||
self.rx.fill_buf().await
|
||||
|
Loading…
Reference in New Issue
Block a user