rppal icon indicating copy to clipboard operation
rppal copied to clipboard

Support concurrent reading and writing via Uart

Open SillyFreak opened this issue 1 year ago • 0 comments

Right now, the Uart struct has two methods

pub fn read(&mut self, buffer: &mut [u8]) -> Result<usize>
pub fn write(&mut self, buffer: &[u8]) -> Result<usize>

for receiving and sending data. As both of these methods require mutable access to the whole struct, reading and writing can't happen concurrently, although I think that should be conceptually possible. I've seen a few approaches that enable this:

Personally I think the third option makes for the best API, because it prevents one from having multiple concurrent readers or writers respectively, but any way to enable this would be great!

SillyFreak avatar Oct 28 '23 13:10 SillyFreak