diff --git a/src/dds.rs b/src/dds.rs new file mode 100644 index 0000000..476dd71 --- /dev/null +++ b/src/dds.rs @@ -0,0 +1,29 @@ +use embedded_hal::blocking::spi::Transfer; +use cortex_m_semihosting::hprintln; +use crate::Error; + +pub struct DDS { + spi: SPI, +} + +impl DDS +where + SPI: Transfer +{ + pub fn new(spi: SPI) -> Self { + DDS { + spi + } + } +} + +impl Transfer for ConfigRegister +where + SPI: Transfer +{ + type Error = Error; + + fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error> { + self.spi.transfer(words).map_err(Error::SPI) + } +}