diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-11-29 17:12:30 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-29 17:12:30 +0100 |
| commit | 384bad7bfaa1f2415baf2cd3b69ebf36dc0a02d7 (patch) | |
| tree | 1992bf003d6afcdeae926db2308f369bccfc42ea /embassy-time/src/delay.rs | |
| parent | b4bc9ac028568dfb3896dfb00cbd1e181863fd64 (diff) | |
| parent | 4634316749c41dd5d8cc2f316033c9098369ed2f (diff) | |
Merge pull request #2231 from embassy-rs/stable3
Update embedded-(hal,io,nal).
Diffstat (limited to 'embassy-time/src/delay.rs')
| -rw-r--r-- | embassy-time/src/delay.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/embassy-time/src/delay.rs b/embassy-time/src/delay.rs index be962747c..aab56b1f1 100644 --- a/embassy-time/src/delay.rs +++ b/embassy-time/src/delay.rs | |||
| @@ -18,7 +18,11 @@ pub struct Delay; | |||
| 18 | mod eh1 { | 18 | mod eh1 { |
| 19 | use super::*; | 19 | use super::*; |
| 20 | 20 | ||
| 21 | impl embedded_hal_1::delay::DelayUs for Delay { | 21 | impl embedded_hal_1::delay::DelayNs for Delay { |
| 22 | fn delay_ns(&mut self, ns: u32) { | ||
| 23 | block_for(Duration::from_nanos(ns as u64)) | ||
| 24 | } | ||
| 25 | |||
| 22 | fn delay_us(&mut self, us: u32) { | 26 | fn delay_us(&mut self, us: u32) { |
| 23 | block_for(Duration::from_micros(us as u64)) | 27 | block_for(Duration::from_micros(us as u64)) |
| 24 | } | 28 | } |
| @@ -34,13 +38,17 @@ mod eha { | |||
| 34 | use super::*; | 38 | use super::*; |
| 35 | use crate::Timer; | 39 | use crate::Timer; |
| 36 | 40 | ||
| 37 | impl embedded_hal_async::delay::DelayUs for Delay { | 41 | impl embedded_hal_async::delay::DelayNs for Delay { |
| 38 | async fn delay_us(&mut self, micros: u32) { | 42 | async fn delay_ns(&mut self, ns: u32) { |
| 39 | Timer::after_micros(micros as _).await | 43 | Timer::after_nanos(ns as _).await |
| 44 | } | ||
| 45 | |||
| 46 | async fn delay_us(&mut self, us: u32) { | ||
| 47 | Timer::after_micros(us as _).await | ||
| 40 | } | 48 | } |
| 41 | 49 | ||
| 42 | async fn delay_ms(&mut self, millis: u32) { | 50 | async fn delay_ms(&mut self, ms: u32) { |
| 43 | Timer::after_millis(millis as _).await | 51 | Timer::after_millis(ms as _).await |
| 44 | } | 52 | } |
| 45 | } | 53 | } |
| 46 | } | 54 | } |
