rp: impl eh1.0 blocking traits

This commit is contained in:
Dario Nieuwenhuis
2022-02-15 17:28:48 +01:00
parent d7aea31a85
commit d9aec181a4
7 changed files with 253 additions and 78 deletions

View File

@ -1,5 +1,5 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "probe-run-rp --chip RP2040"
runner = "probe-run --chip RP2040"
[build]
target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+

View File

@ -7,7 +7,7 @@ version = "0.1.0"
[dependencies]
embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt"] }
embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] }
atomic-polyfill = "0.1.5"
defmt = "0.3"

View File

@ -34,7 +34,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
loop {
cs.set_low();
let mut buf = [0x90, 0x00, 0x00, 0xd0, 0x00, 0x00];
spi.transfer(&mut buf);
spi.blocking_transfer_in_place(&mut buf).unwrap();
cs.set_high();
let x = (buf[1] as u32) << 5 | (buf[2] as u32) >> 3;

View File

@ -131,7 +131,7 @@ impl<'a> embedded_hal::blocking::spi::Write<u8> for DisplaySpi<'a> {
this.display_cs.set_low();
this.last_mode = SpiMode::Display;
}
this.spi.write(words);
this.spi.write(words).unwrap();
Ok(())
}
}
@ -147,7 +147,7 @@ impl<'a> embedded_hal::blocking::spi::Transfer<u8> for TouchSpi<'a> {
this.display_cs.set_high();
this.last_mode = SpiMode::Touch;
}
this.spi.transfer(words);
this.spi.transfer(words).unwrap();
Ok(words)
}
}