File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ impl Delay {
30
30
}
31
31
32
32
/// Delay using the Cortex-M systick for a certain duration, µs.
33
+ #[ inline]
33
34
pub fn delay_us ( & mut self , us : u32 ) {
34
35
let ticks = ( us as u64 ) * ( self . ahb_frequency as u64 ) / 1_000_000 ;
35
36
@@ -57,14 +58,8 @@ impl Delay {
57
58
}
58
59
59
60
/// Delay using the Cortex-M systick for a certain duration, ms.
60
- pub fn delay_ms ( & mut self , ms : u32 ) {
61
- self . delay_us ( ms * 1_000 ) ;
62
- }
63
- }
64
-
65
- impl DelayMs < u32 > for Delay {
66
61
#[ inline]
67
- fn delay_ms ( & mut self , mut ms : u32 ) {
62
+ pub fn delay_ms ( & mut self , mut ms : u32 ) {
68
63
// 4294967 is the highest u32 value which you can multiply by 1000 without overflow
69
64
while ms > 4294967 {
70
65
Delay :: delay_us ( self , 4294967000u32 ) ;
@@ -74,6 +69,13 @@ impl DelayMs<u32> for Delay {
74
69
}
75
70
}
76
71
72
+ impl DelayMs < u32 > for Delay {
73
+ #[ inline]
74
+ fn delay_ms ( & mut self , ms : u32 ) {
75
+ Delay :: delay_ms ( self , ms) ;
76
+ }
77
+ }
78
+
77
79
// This is a workaround to allow `delay_ms(42)` construction without specifying a type.
78
80
impl DelayMs < i32 > for Delay {
79
81
#[ inline( always) ]
You can’t perform that action at this time.
0 commit comments