From 7adf99eff3cf5f8c407168ad618bbe354a4f28eb Mon Sep 17 00:00:00 2001 From: xoviat Date: Wed, 13 Jan 2021 17:40:32 -0600 Subject: [PATCH] implement changes --- embassy-stm32f4/src/serial.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/embassy-stm32f4/src/serial.rs b/embassy-stm32f4/src/serial.rs index c430ee95f..7590fe65a 100644 --- a/embassy-stm32f4/src/serial.rs +++ b/embassy-stm32f4/src/serial.rs @@ -144,14 +144,10 @@ impl Uart for Serial, Stream2> { type ReceiveFuture<'a> = impl Future> + 'a; /// Sends serial data. - /// - /// `tx_buffer` is marked as static as per `embedded-dma` requirements. - /// It it safe to use a buffer with a non static lifetime if memory is not - /// reused until the future has finished. - #[allow(mutable_transmutes)] fn send<'a>(&'a mut self, buf: &'a [u8]) -> Self::SendFuture<'a> { unsafe { INSTANCE = self }; + #[allow(mutable_transmutes)] let static_buf = unsafe { core::mem::transmute::<&'a [u8], &'static mut [u8]>(buf) }; let tx_stream = self.tx_stream.take().unwrap(); @@ -190,10 +186,6 @@ impl Uart for Serial, Stream2> { /// A common pattern is to use [`stop()`](ReceiveFuture::stop) to cancel /// unfinished transfers after a timeout to prevent lockup when no more data /// is incoming. - /// - /// `rx_buffer` is marked as static as per `embedded-dma` requirements. - /// It it safe to use a buffer with a non static lifetime if memory is not - /// reused until the future has finished. fn receive<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReceiveFuture<'a> { unsafe { INSTANCE = self };