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"]
2222default = [ " gpio_cdev" , " gpio_sysfs" , " i2c" , " spi" ]
2323
2424[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 "
2727gpio-cdev = { version = " 0.5.1" , optional = true }
2828sysfs_gpio = { version = " 0.6.1" , optional = true }
2929i2cdev = { version = " 0.6.0" , optional = true }
Original file line number Diff line number Diff line change 33//! [`embedded-hal`]: https://docs.rs/embedded-hal
44
55use cast:: u64;
6- use embedded_hal:: delay:: DelayUs ;
6+ use embedded_hal:: delay:: DelayNs ;
77use std:: thread;
88use std:: time:: Duration ;
99
1010/// Empty struct that provides delay functionality on top of `thread::sleep`
1111pub struct Delay ;
1212
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) ) ) ;
1916 }
2017}
Original file line number Diff line number Diff line change @@ -220,9 +220,9 @@ mod embedded_hal_impl {
220220 } ;
221221 transfers. push ( SpidevTransfer :: read_write ( tx, buf) ) ;
222222 }
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 ) ) ;
226226 }
227227 }
228228 }
You can’t perform that action at this time.
0 commit comments