generic_spi_dev: removed

This commit is contained in:
occheung 2020-08-11 11:32:10 +08:00
parent a1a10d7afe
commit 4596dc29cb
1 changed files with 0 additions and 27 deletions

View File

@ -1,27 +0,0 @@
use embedded_hal::blocking::spi::Transfer;
use cortex_m::asm::nop;
use cortex_m_semihosting::hprintln;
use crate::Error;
pub struct SPIStub<SPI> {
spi: SPI
}
impl<SPI, E> SPIStub<SPI>
where
SPI: Transfer<u8, Error = E>
{
pub fn new(spi: SPI) -> Self {
SPIStub{
spi
}
}
pub fn do_something(&mut self) {
let mut buffer :[u8; 4]= [0xDE, 0xAD, 0xBE, 0xEF];
match self.spi.transfer(&mut buffer).map_err(Error::SPI) {
Ok(arr) => hprintln!("{:?}", arr).unwrap(),
Err(_) => nop(),
}
}
}