rp/pio: wrap sm rx, tx in structs and allow splitting

this *finally* allows sound implementions of bidirectional transfers
without blocking. the futures previously allowed only a single direction
to be active at any given time, and the dma transfers didn't take a
mutable reference and were thus unsound.
This commit is contained in:
pennae
2023-05-03 12:49:55 +02:00
parent 77f7830da3
commit c44c108db5
6 changed files with 204 additions and 169 deletions

View File

@ -87,7 +87,7 @@ impl<'d, P: PioInstance, const S: usize> Ws2812<'d, P, S> {
pub async fn write(&mut self, colors: &[RGB8]) {
for color in colors {
let word = (u32::from(color.g) << 24) | (u32::from(color.r) << 16) | (u32::from(color.b) << 8);
self.sm.wait_push(word).await;
self.sm.tx().wait_push(word).await;
}
}
}