Open
Description
The uart-dma example does not show how to send data with different length using dma.
Is this not supported by this crate or is it even a hardware limitation?
example:
[...]
let data_to_send = [
&b"Hello"[..], // These are to be sent one at a time to simulate sending messages of different sizes
&b"I"[..],
&b"am Bob the Bot"[..],
];
// Setup DMA for USART2 TX with dma channel 1.
let mut transfer =
streams
.0
.into_memory_to_peripheral_transfer(tx.enable_dma(), &mut tx_buffer[..], config);
transfer.start(|_tx| {});
loop {
while !transfer.get_transfer_complete_flag() {}
delay_syst.delay(1000.millis());
led.toggle().unwrap();
transfer.restart(|_tx| {}); // <---------- Do something here to either change buffer to data_to_send[i],
// , or copy to tx_buffer (assuming it is large enough) and tell `transfer` the new data length
}
Activity
usbalbin commentedon Feb 14, 2024
To me I think it would have made more sense if the uart and dma stream were combined into a "uart-with-dma" rather than a "dma-stream-thing that happens to wrap an uart".
So instead of
I would want
since
Tx<UART2, PIN, DMA>
can then implcore::fmt::Write
(or some more appropriate alternative), set senseful dma configs automatically etc since it has more knowledge of how the dma channel will be used.Any thoughts? :)