diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-11-29 16:37:07 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-11-29 17:01:36 +0100 |
| commit | 4634316749c41dd5d8cc2f316033c9098369ed2f (patch) | |
| tree | 1992bf003d6afcdeae926db2308f369bccfc42ea /embassy-embedded-hal/src/shared_bus/blocking | |
| parent | 1b9925e3da0ec42b770f736cd22325203c97cb47 (diff) | |
Update embedded-(hal,io,nal).
Diffstat (limited to 'embassy-embedded-hal/src/shared_bus/blocking')
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/blocking/spi.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs index 2b67862ea..59b65bfbd 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs | |||
| @@ -55,8 +55,8 @@ where | |||
| 55 | CS: OutputPin, | 55 | CS: OutputPin, |
| 56 | { | 56 | { |
| 57 | fn transaction(&mut self, operations: &mut [Operation<'_, u8>]) -> Result<(), Self::Error> { | 57 | fn transaction(&mut self, operations: &mut [Operation<'_, u8>]) -> Result<(), Self::Error> { |
| 58 | if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayUs(_))) { | 58 | if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) { |
| 59 | return Err(SpiDeviceError::DelayUsNotSupported); | 59 | return Err(SpiDeviceError::DelayNotSupported); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | self.bus.lock(|bus| { | 62 | self.bus.lock(|bus| { |
| @@ -69,10 +69,10 @@ where | |||
| 69 | Operation::Transfer(read, write) => bus.transfer(read, write), | 69 | Operation::Transfer(read, write) => bus.transfer(read, write), |
| 70 | Operation::TransferInPlace(buf) => bus.transfer_in_place(buf), | 70 | Operation::TransferInPlace(buf) => bus.transfer_in_place(buf), |
| 71 | #[cfg(not(feature = "time"))] | 71 | #[cfg(not(feature = "time"))] |
| 72 | Operation::DelayUs(_) => unreachable!(), | 72 | Operation::DelayNs(_) => unreachable!(), |
| 73 | #[cfg(feature = "time")] | 73 | #[cfg(feature = "time")] |
| 74 | Operation::DelayUs(us) => { | 74 | Operation::DelayNs(ns) => { |
| 75 | embassy_time::block_for(embassy_time::Duration::from_micros(*us as _)); | 75 | embassy_time::block_for(embassy_time::Duration::from_nanos(*ns as _)); |
| 76 | Ok(()) | 76 | Ok(()) |
| 77 | } | 77 | } |
| 78 | }); | 78 | }); |
| @@ -165,8 +165,8 @@ where | |||
| 165 | CS: OutputPin, | 165 | CS: OutputPin, |
| 166 | { | 166 | { |
| 167 | fn transaction(&mut self, operations: &mut [Operation<'_, u8>]) -> Result<(), Self::Error> { | 167 | fn transaction(&mut self, operations: &mut [Operation<'_, u8>]) -> Result<(), Self::Error> { |
| 168 | if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayUs(_))) { | 168 | if cfg!(not(feature = "time")) && operations.iter().any(|op| matches!(op, Operation::DelayNs(_))) { |
| 169 | return Err(SpiDeviceError::DelayUsNotSupported); | 169 | return Err(SpiDeviceError::DelayNotSupported); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | self.bus.lock(|bus| { | 172 | self.bus.lock(|bus| { |
| @@ -180,10 +180,10 @@ where | |||
| 180 | Operation::Transfer(read, write) => bus.transfer(read, write), | 180 | Operation::Transfer(read, write) => bus.transfer(read, write), |
| 181 | Operation::TransferInPlace(buf) => bus.transfer_in_place(buf), | 181 | Operation::TransferInPlace(buf) => bus.transfer_in_place(buf), |
| 182 | #[cfg(not(feature = "time"))] | 182 | #[cfg(not(feature = "time"))] |
| 183 | Operation::DelayUs(_) => unreachable!(), | 183 | Operation::DelayNs(_) => unreachable!(), |
| 184 | #[cfg(feature = "time")] | 184 | #[cfg(feature = "time")] |
| 185 | Operation::DelayUs(us) => { | 185 | Operation::DelayNs(ns) => { |
| 186 | embassy_time::block_for(embassy_time::Duration::from_micros(*us as _)); | 186 | embassy_time::block_for(embassy_time::Duration::from_nanos(*ns as _)); |
| 187 | Ok(()) | 187 | Ok(()) |
| 188 | } | 188 | } |
| 189 | }); | 189 | }); |
