rp: fix async SPI read and write

This commit is contained in:
Alex Martens
2022-09-18 12:02:05 -07:00
parent 336ebe54c0
commit ab1a6889a6
2 changed files with 79 additions and 18 deletions

View File

@ -56,6 +56,25 @@ pub unsafe fn read<'a, C: Channel, W: Word>(
)
}
pub unsafe fn read_repeated<'a, C: Channel, W: Word>(
ch: impl Peripheral<P = C> + 'a,
from: *const W,
len: usize,
dreq: u8,
) -> Transfer<'a, C> {
let mut dummy: u32 = 0;
copy_inner(
ch,
from as *const u32,
&mut dummy as *mut u32,
len,
W::size(),
false,
false,
dreq,
)
}
pub unsafe fn write<'a, C: Channel, W: Word>(
ch: impl Peripheral<P = C> + 'a,
from: *const [W],
@ -75,6 +94,25 @@ pub unsafe fn write<'a, C: Channel, W: Word>(
)
}
pub unsafe fn write_repeated<'a, C: Channel, W: Word>(
ch: impl Peripheral<P = C> + 'a,
to: *mut W,
len: usize,
dreq: u8,
) -> Transfer<'a, C> {
let dummy: u32 = 0;
copy_inner(
ch,
&dummy as *const u32,
to as *mut u32,
len,
W::size(),
false,
false,
dreq,
)
}
pub unsafe fn copy<'a, C: Channel, W: Word>(
ch: impl Peripheral<P = C> + 'a,
from: &[W],