aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/rpi-pico-w/src/main.rs14
1 files changed, 7 insertions, 7 deletions
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 {
153 } 153 }
154} 154}
155 155
156impl SpiBusRead for MySpi { 156impl SpiBusRead<u32> for MySpi {
157 type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> 157 type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>>
158 where 158 where
159 Self: 'a; 159 Self: 'a;
160 160
161 fn read<'a>(&'a mut self, words: &'a mut [u8]) -> Self::ReadFuture<'a> { 161 fn read<'a>(&'a mut self, words: &'a mut [u32]) -> Self::ReadFuture<'a> {
162 async move { 162 async move {
163 self.dio.set_as_input(); 163 self.dio.set_as_input();
164 for word in words { 164 for word in words {
165 let mut w = 0; 165 let mut w = 0;
166 for _ in 0..8 { 166 for _ in 0..32 {
167 w = w << 1; 167 w = w << 1;
168 168
169 // rising edge, sample data 169 // rising edge, sample data
@@ -183,20 +183,20 @@ impl SpiBusRead for MySpi {
183 } 183 }
184} 184}
185 185
186impl SpiBusWrite for MySpi { 186impl SpiBusWrite<u32> for MySpi {
187 type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> 187 type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>>
188 where 188 where
189 Self: 'a; 189 Self: 'a;
190 190
191 fn write<'a>(&'a mut self, words: &'a [u8]) -> Self::WriteFuture<'a> { 191 fn write<'a>(&'a mut self, words: &'a [u32]) -> Self::WriteFuture<'a> {
192 async move { 192 async move {
193 self.dio.set_as_output(); 193 self.dio.set_as_output();
194 for word in words { 194 for word in words {
195 let mut word = *word; 195 let mut word = *word;
196 for _ in 0..8 { 196 for _ in 0..32 {
197 // falling edge, setup data 197 // falling edge, setup data
198 self.clk.set_low(); 198 self.clk.set_low();
199 if word & 0x80 == 0 { 199 if word & 0x8000_0000 == 0 {
200 self.dio.set_low(); 200 self.dio.set_low();
201 } else { 201 } else {
202 self.dio.set_high(); 202 self.dio.set_high();