File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ bare-metal = "1"
21
21
volatile-register = " 0.2.0"
22
22
bitfield = " 0.13.2"
23
23
embedded-hal = " 0.2.4"
24
+ eh1_0_alpha = { version = " =1.0.0-alpha.8" , package =" embedded-hal" , optional =true }
25
+
24
26
25
27
[dependencies .serde ]
26
28
version = " 1"
Original file line number Diff line number Diff line change 1
1
//! A delay driver based on SysTick.
2
2
3
3
use crate :: peripheral:: { syst:: SystClkSource , SYST } ;
4
+ #[ cfg( feature = "eh1_0_alpha" ) ]
5
+ use core:: convert:: Infallible ;
6
+
7
+ #[ cfg( feature = "eh1_0_alpha" ) ]
8
+ use eh1_0_alpha:: delay:: blocking:: DelayUs as EH1DelayUs ;
4
9
use embedded_hal:: blocking:: delay:: { DelayMs , DelayUs } ;
5
10
6
11
/// System timer (SysTick) as a delay provider.
@@ -75,6 +80,22 @@ impl Delay {
75
80
}
76
81
}
77
82
83
+ #[ cfg( feature = "eh1_0_alpha" ) ]
84
+ impl EH1DelayUs for Delay {
85
+ type Error = Infallible ;
86
+
87
+ #[ inline]
88
+ fn delay_us ( & mut self , us : u32 ) -> Result < ( ) , Self :: Error > {
89
+ Delay :: delay_us ( self , us) ;
90
+ Ok ( ( ) )
91
+ }
92
+
93
+ fn delay_ms ( & mut self , us : u32 ) -> Result < ( ) , Self :: Error > {
94
+ Delay :: delay_ms ( self , us) ;
95
+ Ok ( ( ) )
96
+ }
97
+ }
98
+
78
99
impl DelayMs < u32 > for Delay {
79
100
#[ inline]
80
101
fn delay_ms ( & mut self , ms : u32 ) {
You can’t perform that action at this time.
0 commit comments