670: Make UART futures Send r=Dirbaio a=chemicstry

This is a quick fix to make `Uart` futures implement `Send`.

Previously they were `!Send`, because pointer to the data register was held across an await point. Simple rearrange fixes the issue.

Co-authored-by: chemicstry <chemicstry@gmail.com>
This commit is contained in:
bors[bot] 2022-03-17 18:09:57 +00:00 committed by GitHub
commit 5f39f13616
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -106,8 +106,10 @@ impl<'d, T: Instance, TxDma> UartTx<'d, T, TxDma> {
reg.set_dmat(true); reg.set_dmat(true);
}); });
} }
let dst = tdr(T::regs()); // If we don't assign future to a variable, the data register pointer
crate::dma::write(ch, request, buffer, dst).await; // is held across an await and makes the future non-Send.
let transfer = crate::dma::write(ch, request, buffer, tdr(T::regs()));
transfer.await;
Ok(()) Ok(())
} }
@ -150,9 +152,10 @@ impl<'d, T: Instance, RxDma> UartRx<'d, T, RxDma> {
reg.set_dmar(true); reg.set_dmar(true);
}); });
} }
let r = T::regs(); // If we don't assign future to a variable, the data register pointer
let src = rdr(r); // is held across an await and makes the future non-Send.
crate::dma::read(ch, request, src, buffer).await; let transfer = crate::dma::read(ch, request, rdr(T::regs()), buffer);
transfer.await;
Ok(()) Ok(())
} }