File tree Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ spi = ["spidev"]
22
22
default = [ " gpio_cdev" , " gpio_sysfs" , " i2c" , " spi" ]
23
23
24
24
[dependencies ]
25
- embedded-hal = " =1.0.0-rc.1 "
26
- embedded-hal-nb = " =1.0.0-rc.1 "
25
+ embedded-hal = " =1.0.0-rc.2 "
26
+ embedded-hal-nb = " =1.0.0-rc.2 "
27
27
gpio-cdev = { version = " 0.5.1" , optional = true }
28
28
sysfs_gpio = { version = " 0.6.1" , optional = true }
29
29
i2cdev = { version = " 0.6.0" , optional = true }
Original file line number Diff line number Diff line change 3
3
//! [`embedded-hal`]: https://docs.rs/embedded-hal
4
4
5
5
use cast:: u64;
6
- use embedded_hal:: delay:: DelayUs ;
6
+ use embedded_hal:: delay:: DelayNs ;
7
7
use std:: thread;
8
8
use std:: time:: Duration ;
9
9
10
10
/// Empty struct that provides delay functionality on top of `thread::sleep`
11
11
pub struct Delay ;
12
12
13
- impl DelayUs for Delay {
14
- fn delay_us ( & mut self , n : u32 ) {
15
- let secs = n / 1_000_000 ;
16
- let nsecs = ( n % 1_000_000 ) * 1_000 ;
17
-
18
- thread:: sleep ( Duration :: new ( u64 ( secs) , nsecs) ) ;
13
+ impl DelayNs for Delay {
14
+ fn delay_ns ( & mut self , n : u32 ) {
15
+ thread:: sleep ( Duration :: from_nanos ( u64 ( n) ) ) ;
19
16
}
20
17
}
Original file line number Diff line number Diff line change @@ -220,9 +220,9 @@ mod embedded_hal_impl {
220
220
} ;
221
221
transfers. push ( SpidevTransfer :: read_write ( tx, buf) ) ;
222
222
}
223
- SpiOperation :: DelayUs ( us ) => {
224
- let us = ( * us ) . try_into ( ) . unwrap_or ( u16:: MAX ) ;
225
- transfers. push ( SpidevTransfer :: delay ( us ) ) ;
223
+ SpiOperation :: DelayNs ( ns ) => {
224
+ let ns = ( * ns ) . try_into ( ) . unwrap_or ( u16:: MAX ) ;
225
+ transfers. push ( SpidevTransfer :: delay ( ns ) ) ;
226
226
}
227
227
}
228
228
}
You can’t perform that action at this time.
0 commit comments