Add Enc424j600::init() for complete initialisation

This commit is contained in:
Harry Ho 2021-04-27 17:13:01 +08:00
parent 78e4d82660
commit 6d17703e6b
1 changed files with 7 additions and 0 deletions

View File

@ -61,6 +61,13 @@ impl <SPI: Transfer<u8>,
} }
} }
pub fn init(&mut self) -> Result<(), Error> {
self.reset()?;
self.init_rxbuf()?;
self.init_txbuf()?;
Ok(())
}
pub fn reset(&mut self) -> Result<(), Error> { pub fn reset(&mut self) -> Result<(), Error> {
// Write 0x1234 to EUDAST // Write 0x1234 to EUDAST
self.spi_port.write_reg_16b(spi::addrs::EUDAST, 0x1234)?; self.spi_port.write_reg_16b(spi::addrs::EUDAST, 0x1234)?;