more improvements for spi module
All checks were successful
Rust/va416xx-rs/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2024-09-19 16:42:08 +02:00
parent 9bda3f29f4
commit f89d1b1129
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -653,7 +653,7 @@ where
pub fn cfg_transfer<HwCs: OptionalHwCs<SpiInstance>>( pub fn cfg_transfer<HwCs: OptionalHwCs<SpiInstance>>(
&mut self, &mut self,
transfer_cfg: &TransferConfigWithHwcs<HwCs>, transfer_cfg: &TransferConfigWithHwcs<HwCs>,
) -> Result<(), SpiClkConfigError> { ) {
if let Some(trans_clk_div) = transfer_cfg.cfg.clk_cfg { if let Some(trans_clk_div) = transfer_cfg.cfg.clk_cfg {
self.cfg_clock(trans_clk_div); self.cfg_clock(trans_clk_div);
} }
@ -679,7 +679,6 @@ where
} }
w w
}); });
Ok(())
} }
fn flush_internal(&self) { fn flush_internal(&self) {
@ -883,7 +882,7 @@ where
pub fn cfg_transfer<HwCs: OptionalHwCs<SpiI>>( pub fn cfg_transfer<HwCs: OptionalHwCs<SpiI>>(
&mut self, transfer_cfg: &TransferConfigWithHwcs<HwCs> &mut self, transfer_cfg: &TransferConfigWithHwcs<HwCs>
) -> Result<(), SpiClkConfigError>; );
} }
} }
@ -1060,23 +1059,13 @@ impl<
where where
<Word as TryFrom<u32>>::Error: core::fmt::Debug, <Word as TryFrom<u32>>::Error: core::fmt::Debug,
{ {
fn read(&mut self, words: &mut [Word]) -> Result<(), Self::Error> { delegate::delegate! {
self.inner.read(words) to self.inner {
} fn read(&mut self, words: &mut [Word]) -> Result<(), Self::Error>;
fn write(&mut self, words: &[Word]) -> Result<(), Self::Error>;
fn write(&mut self, words: &[Word]) -> Result<(), Self::Error> { fn transfer(&mut self, read: &mut [Word], write: &[Word]) -> Result<(), Self::Error>;
self.inner.write(words) fn transfer_in_place(&mut self, words: &mut [Word]) -> Result<(), Self::Error>;
} fn flush(&mut self) -> Result<(), Self::Error>;
}
fn transfer(&mut self, read: &mut [Word], write: &[Word]) -> Result<(), Self::Error> {
self.inner.transfer(read, write)
}
fn transfer_in_place(&mut self, words: &mut [Word]) -> Result<(), Self::Error> {
self.inner.transfer_in_place(words)
}
fn flush(&mut self) -> Result<(), Self::Error> {
self.inner.flush()
} }
} }