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