From a5cf65a17bf87dddf04d8c3c858710a54bc0c4b3 Mon Sep 17 00:00:00 2001 From: xoviat Date: Wed, 30 Dec 2020 19:45:07 -0600 Subject: [PATCH] impl. poll:ready --- embassy-stm32f4/src/serial.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/embassy-stm32f4/src/serial.rs b/embassy-stm32f4/src/serial.rs index eac11d31..57c97041 100644 --- a/embassy-stm32f4/src/serial.rs +++ b/embassy-stm32f4/src/serial.rs @@ -242,20 +242,18 @@ impl<'a, B> Future for ReceiveFuture<'a, B> where B: WriteBuffer + 'static + Unpin, { - type Output = (); + type Output = B; - fn poll(self: core::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> { + fn poll(self: core::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let Self { uarte, rx_transfer } = unsafe { self.get_unchecked_mut() }; if true { - // self.rx_transfer.unwrap().is_done() { let (rx_stream, usart, buf, _) = rx_transfer.take().unwrap().free(); uarte.rx_stream.replace(rx_stream); uarte.usart.replace(usart); - // Poll::Ready((buf)) - Poll::Ready(()) + Poll::Ready(buf) } else { waker_interrupt!(DMA2_STREAM2, cx.waker().clone());