44
55use cast:: { u32, u64} ;
66use core:: convert:: Infallible ;
7- use embedded_hal:: blocking :: delay :: { DelayMs , DelayUs } ;
7+ use embedded_hal:: delay :: blocking :: { DelayMs , DelayUs } ;
88use std:: thread;
99use std:: time:: Duration ;
1010
@@ -14,7 +14,7 @@ pub struct Delay;
1414impl DelayUs < u8 > for Delay {
1515 type Error = Infallible ;
1616
17- fn try_delay_us ( & mut self , n : u8 ) -> Result < ( ) , Self :: Error > {
17+ fn delay_us ( & mut self , n : u8 ) -> Result < ( ) , Self :: Error > {
1818 thread:: sleep ( Duration :: new ( 0 , u32 ( n) * 1000 ) ) ;
1919 Ok ( ( ) )
2020 }
@@ -23,7 +23,7 @@ impl DelayUs<u8> for Delay {
2323impl DelayUs < u16 > for Delay {
2424 type Error = Infallible ;
2525
26- fn try_delay_us ( & mut self , n : u16 ) -> Result < ( ) , Self :: Error > {
26+ fn delay_us ( & mut self , n : u16 ) -> Result < ( ) , Self :: Error > {
2727 thread:: sleep ( Duration :: new ( 0 , u32 ( n) * 1000 ) ) ;
2828 Ok ( ( ) )
2929 }
@@ -32,7 +32,7 @@ impl DelayUs<u16> for Delay {
3232impl DelayUs < u32 > for Delay {
3333 type Error = Infallible ;
3434
35- fn try_delay_us ( & mut self , n : u32 ) -> Result < ( ) , Self :: Error > {
35+ fn delay_us ( & mut self , n : u32 ) -> Result < ( ) , Self :: Error > {
3636 let secs = n / 1_000_000 ;
3737 let nsecs = ( n % 1_000_000 ) * 1_000 ;
3838
@@ -44,7 +44,7 @@ impl DelayUs<u32> for Delay {
4444impl DelayUs < u64 > for Delay {
4545 type Error = Infallible ;
4646
47- fn try_delay_us ( & mut self , n : u64 ) -> Result < ( ) , Self :: Error > {
47+ fn delay_us ( & mut self , n : u64 ) -> Result < ( ) , Self :: Error > {
4848 let secs = n / 1_000_000 ;
4949 let nsecs = ( ( n % 1_000_000 ) * 1_000 ) as u32 ;
5050
@@ -56,7 +56,7 @@ impl DelayUs<u64> for Delay {
5656impl DelayMs < u8 > for Delay {
5757 type Error = Infallible ;
5858
59- fn try_delay_ms ( & mut self , n : u8 ) -> Result < ( ) , Self :: Error > {
59+ fn delay_ms ( & mut self , n : u8 ) -> Result < ( ) , Self :: Error > {
6060 thread:: sleep ( Duration :: from_millis ( u64 ( n) ) ) ;
6161 Ok ( ( ) )
6262 }
@@ -65,7 +65,7 @@ impl DelayMs<u8> for Delay {
6565impl DelayMs < u16 > for Delay {
6666 type Error = Infallible ;
6767
68- fn try_delay_ms ( & mut self , n : u16 ) -> Result < ( ) , Self :: Error > {
68+ fn delay_ms ( & mut self , n : u16 ) -> Result < ( ) , Self :: Error > {
6969 thread:: sleep ( Duration :: from_millis ( u64 ( n) ) ) ;
7070 Ok ( ( ) )
7171 }
@@ -74,7 +74,7 @@ impl DelayMs<u16> for Delay {
7474impl DelayMs < u32 > for Delay {
7575 type Error = Infallible ;
7676
77- fn try_delay_ms ( & mut self , n : u32 ) -> Result < ( ) , Self :: Error > {
77+ fn delay_ms ( & mut self , n : u32 ) -> Result < ( ) , Self :: Error > {
7878 thread:: sleep ( Duration :: from_millis ( u64 ( n) ) ) ;
7979 Ok ( ( ) )
8080 }
@@ -83,7 +83,7 @@ impl DelayMs<u32> for Delay {
8383impl DelayMs < u64 > for Delay {
8484 type Error = Infallible ;
8585
86- fn try_delay_ms ( & mut self , n : u64 ) -> Result < ( ) , Self :: Error > {
86+ fn delay_ms ( & mut self , n : u64 ) -> Result < ( ) , Self :: Error > {
8787 thread:: sleep ( Duration :: from_millis ( n) ) ;
8888 Ok ( ( ) )
8989 }
0 commit comments