From 931e3d7ee0cb1ff9f320b22aab3f4ea375a1c624 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sat, 16 Jul 2022 18:06:57 +0200 Subject: Switch to 32bit SPI. --- examples/rpi-pico-w/src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/rpi-pico-w/src/main.rs b/examples/rpi-pico-w/src/main.rs index 655535f9d..475c69067 100644 --- a/examples/rpi-pico-w/src/main.rs +++ b/examples/rpi-pico-w/src/main.rs @@ -153,17 +153,17 @@ impl SpiBusFlush for MySpi { } } -impl SpiBusRead for MySpi { +impl SpiBusRead for MySpi { type ReadFuture<'a> = impl Future> where Self: 'a; - fn read<'a>(&'a mut self, words: &'a mut [u8]) -> Self::ReadFuture<'a> { + fn read<'a>(&'a mut self, words: &'a mut [u32]) -> Self::ReadFuture<'a> { async move { self.dio.set_as_input(); for word in words { let mut w = 0; - for _ in 0..8 { + for _ in 0..32 { w = w << 1; // rising edge, sample data @@ -183,20 +183,20 @@ impl SpiBusRead for MySpi { } } -impl SpiBusWrite for MySpi { +impl SpiBusWrite for MySpi { type WriteFuture<'a> = impl Future> where Self: 'a; - fn write<'a>(&'a mut self, words: &'a [u8]) -> Self::WriteFuture<'a> { + fn write<'a>(&'a mut self, words: &'a [u32]) -> Self::WriteFuture<'a> { async move { self.dio.set_as_output(); for word in words { let mut word = *word; - for _ in 0..8 { + for _ in 0..32 { // falling edge, setup data self.clk.set_low(); - if word & 0x80 == 0 { + if word & 0x8000_0000 == 0 { self.dio.set_low(); } else { self.dio.set_high(); -- cgit