1212
1313#![ deny( missing_docs) ]
1414
15- extern crate cast;
16- extern crate embedded_hal as hal;
17- pub extern crate i2cdev;
18- pub extern crate nb;
19- pub extern crate serial_core;
20- pub extern crate serial_unix;
21- pub extern crate spidev;
15+ use cast;
16+ pub use i2cdev;
17+ pub use nb;
18+ pub use serial_core;
19+ pub use serial_unix;
20+ pub use spidev;
2221
2322#[ cfg( feature = "gpio_sysfs" ) ]
24- pub extern crate sysfs_gpio;
23+ pub use sysfs_gpio;
2524
2625#[ cfg( feature = "gpio_cdev" ) ]
27- pub extern crate gpio_cdev;
26+ pub use gpio_cdev;
27+
2828
2929use core:: convert:: Infallible ;
3030use std:: io:: { self , Write } ;
@@ -61,7 +61,7 @@ pub use sysfs_pin::SysfsPin;
6161/// Empty struct that provides delay functionality on top of `thread::sleep`
6262pub struct Delay ;
6363
64- impl hal :: blocking:: delay:: DelayUs < u8 > for Delay {
64+ impl embedded_hal :: blocking:: delay:: DelayUs < u8 > for Delay {
6565 type Error = Infallible ;
6666
6767 fn try_delay_us ( & mut self , n : u8 ) -> Result < ( ) , Self :: Error > {
@@ -70,7 +70,7 @@ impl hal::blocking::delay::DelayUs<u8> for Delay {
7070 }
7171}
7272
73- impl hal :: blocking:: delay:: DelayUs < u16 > for Delay {
73+ impl embedded_hal :: blocking:: delay:: DelayUs < u16 > for Delay {
7474 type Error = Infallible ;
7575
7676 fn try_delay_us ( & mut self , n : u16 ) -> Result < ( ) , Self :: Error > {
@@ -79,7 +79,7 @@ impl hal::blocking::delay::DelayUs<u16> for Delay {
7979 }
8080}
8181
82- impl hal :: blocking:: delay:: DelayUs < u32 > for Delay {
82+ impl embedded_hal :: blocking:: delay:: DelayUs < u32 > for Delay {
8383 type Error = Infallible ;
8484
8585 fn try_delay_us ( & mut self , n : u32 ) -> Result < ( ) , Self :: Error > {
@@ -91,7 +91,7 @@ impl hal::blocking::delay::DelayUs<u32> for Delay {
9191 }
9292}
9393
94- impl hal :: blocking:: delay:: DelayUs < u64 > for Delay {
94+ impl embedded_hal :: blocking:: delay:: DelayUs < u64 > for Delay {
9595 type Error = Infallible ;
9696
9797 fn try_delay_us ( & mut self , n : u64 ) -> Result < ( ) , Self :: Error > {
@@ -103,7 +103,7 @@ impl hal::blocking::delay::DelayUs<u64> for Delay {
103103 }
104104}
105105
106- impl hal :: blocking:: delay:: DelayMs < u8 > for Delay {
106+ impl embedded_hal :: blocking:: delay:: DelayMs < u8 > for Delay {
107107 type Error = Infallible ;
108108
109109 fn try_delay_ms ( & mut self , n : u8 ) -> Result < ( ) , Self :: Error > {
@@ -112,7 +112,7 @@ impl hal::blocking::delay::DelayMs<u8> for Delay {
112112 }
113113}
114114
115- impl hal :: blocking:: delay:: DelayMs < u16 > for Delay {
115+ impl embedded_hal :: blocking:: delay:: DelayMs < u16 > for Delay {
116116 type Error = Infallible ;
117117
118118 fn try_delay_ms ( & mut self , n : u16 ) -> Result < ( ) , Self :: Error > {
@@ -121,7 +121,7 @@ impl hal::blocking::delay::DelayMs<u16> for Delay {
121121 }
122122}
123123
124- impl hal :: blocking:: delay:: DelayMs < u32 > for Delay {
124+ impl embedded_hal :: blocking:: delay:: DelayMs < u32 > for Delay {
125125 type Error = Infallible ;
126126
127127 fn try_delay_ms ( & mut self , n : u32 ) -> Result < ( ) , Self :: Error > {
@@ -130,7 +130,7 @@ impl hal::blocking::delay::DelayMs<u32> for Delay {
130130 }
131131}
132132
133- impl hal :: blocking:: delay:: DelayMs < u64 > for Delay {
133+ impl embedded_hal :: blocking:: delay:: DelayMs < u64 > for Delay {
134134 type Error = Infallible ;
135135
136136 fn try_delay_ms ( & mut self , n : u64 ) -> Result < ( ) , Self :: Error > {
@@ -173,7 +173,7 @@ impl I2cdev {
173173 }
174174}
175175
176- impl hal :: blocking:: i2c:: Read for I2cdev {
176+ impl embedded_hal :: blocking:: i2c:: Read for I2cdev {
177177 type Error = i2cdev:: linux:: LinuxI2CError ;
178178
179179 fn try_read ( & mut self , address : u8 , buffer : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
@@ -182,7 +182,7 @@ impl hal::blocking::i2c::Read for I2cdev {
182182 }
183183}
184184
185- impl hal :: blocking:: i2c:: Write for I2cdev {
185+ impl embedded_hal :: blocking:: i2c:: Write for I2cdev {
186186 type Error = i2cdev:: linux:: LinuxI2CError ;
187187
188188 fn try_write ( & mut self , address : u8 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
@@ -191,7 +191,7 @@ impl hal::blocking::i2c::Write for I2cdev {
191191 }
192192}
193193
194- impl hal :: blocking:: i2c:: WriteRead for I2cdev {
194+ impl embedded_hal :: blocking:: i2c:: WriteRead for I2cdev {
195195 type Error = i2cdev:: linux:: LinuxI2CError ;
196196
197197 fn try_write_read (
@@ -240,7 +240,7 @@ impl Spidev {
240240 }
241241}
242242
243- impl hal :: blocking:: spi:: Transfer < u8 > for Spidev {
243+ impl embedded_hal :: blocking:: spi:: Transfer < u8 > for Spidev {
244244 type Error = io:: Error ;
245245
246246 fn try_transfer < ' b > ( & mut self , buffer : & ' b mut [ u8 ] ) -> io:: Result < & ' b [ u8 ] > {
@@ -251,18 +251,18 @@ impl hal::blocking::spi::Transfer<u8> for Spidev {
251251 }
252252}
253253
254- impl hal :: blocking:: spi:: Write < u8 > for Spidev {
254+ impl embedded_hal :: blocking:: spi:: Write < u8 > for Spidev {
255255 type Error = io:: Error ;
256256
257257 fn try_write ( & mut self , buffer : & [ u8 ] ) -> io:: Result < ( ) > {
258258 self . 0 . write_all ( buffer)
259259 }
260260}
261261
262- pub use hal :: blocking:: spi:: { Operation as SpiOperation } ;
262+ pub use embedded_hal :: blocking:: spi:: { Operation as SpiOperation } ;
263263
264264/// Transactional implementation batches SPI operations into a single transaction
265- impl hal :: blocking:: spi:: Transactional < u8 > for Spidev {
265+ impl embedded_hal :: blocking:: spi:: Transactional < u8 > for Spidev {
266266 type Error = io:: Error ;
267267
268268 fn try_exec < ' a > ( & mut self , operations : & mut [ SpiOperation < ' a , u8 > ] ) -> Result < ( ) , Self :: Error > {
@@ -285,9 +285,7 @@ impl hal::blocking::spi::Transactional<u8> for Spidev {
285285 } ) . collect ( ) ;
286286
287287 // Execute transfer
288- self . 0 . transfer_multiple ( & mut messages) ?;
289-
290- Ok ( ( ) )
288+ self . 0 . transfer_multiple ( & mut messages)
291289 }
292290}
293291
0 commit comments