File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,27 @@ impl DelayNs for Delay {
14
14
fn delay_ns ( & mut self , n : u32 ) {
15
15
thread:: sleep ( Duration :: from_nanos ( n. into ( ) ) ) ;
16
16
}
17
+
18
+ fn delay_us ( & mut self , n : u32 ) {
19
+ thread:: sleep ( Duration :: from_micros ( n. into ( ) ) ) ;
20
+ }
21
+
22
+ fn delay_ms ( & mut self , n : u32 ) {
23
+ thread:: sleep ( Duration :: from_millis ( n. into ( ) ) ) ;
24
+ }
17
25
}
18
26
19
27
#[ cfg( feature = "async-tokio" ) ]
20
28
impl embedded_hal_async:: delay:: DelayNs for Delay {
21
29
async fn delay_ns ( & mut self , n : u32 ) {
22
30
tokio:: time:: sleep ( Duration :: from_nanos ( n. into ( ) ) ) . await ;
23
31
}
32
+
33
+ async fn delay_us ( & mut self , n : u32 ) {
34
+ tokio:: time:: sleep ( Duration :: from_micros ( n. into ( ) ) ) . await ;
35
+ }
36
+
37
+ async fn delay_ms ( & mut self , n : u32 ) {
38
+ tokio:: time:: sleep ( Duration :: from_millis ( n. into ( ) ) ) . await ;
39
+ }
24
40
}
You can’t perform that action at this time.
0 commit comments