Merge #670
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:
		| @@ -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(()) | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user