12
12
13
13
#![ deny( missing_docs) ]
14
14
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;
22
21
23
22
#[ cfg( feature = "gpio_sysfs" ) ]
24
- pub extern crate sysfs_gpio;
23
+ pub use sysfs_gpio;
25
24
26
25
#[ cfg( feature = "gpio_cdev" ) ]
27
- pub extern crate gpio_cdev;
26
+ pub use gpio_cdev;
27
+
28
28
29
29
use core:: convert:: Infallible ;
30
30
use std:: io:: { self , Write } ;
@@ -61,7 +61,7 @@ pub use sysfs_pin::SysfsPin;
61
61
/// Empty struct that provides delay functionality on top of `thread::sleep`
62
62
pub struct Delay ;
63
63
64
- impl hal :: blocking:: delay:: DelayUs < u8 > for Delay {
64
+ impl embedded_hal :: blocking:: delay:: DelayUs < u8 > for Delay {
65
65
type Error = Infallible ;
66
66
67
67
fn try_delay_us ( & mut self , n : u8 ) -> Result < ( ) , Self :: Error > {
@@ -70,7 +70,7 @@ impl hal::blocking::delay::DelayUs<u8> for Delay {
70
70
}
71
71
}
72
72
73
- impl hal :: blocking:: delay:: DelayUs < u16 > for Delay {
73
+ impl embedded_hal :: blocking:: delay:: DelayUs < u16 > for Delay {
74
74
type Error = Infallible ;
75
75
76
76
fn try_delay_us ( & mut self , n : u16 ) -> Result < ( ) , Self :: Error > {
@@ -79,7 +79,7 @@ impl hal::blocking::delay::DelayUs<u16> for Delay {
79
79
}
80
80
}
81
81
82
- impl hal :: blocking:: delay:: DelayUs < u32 > for Delay {
82
+ impl embedded_hal :: blocking:: delay:: DelayUs < u32 > for Delay {
83
83
type Error = Infallible ;
84
84
85
85
fn try_delay_us ( & mut self , n : u32 ) -> Result < ( ) , Self :: Error > {
@@ -91,7 +91,7 @@ impl hal::blocking::delay::DelayUs<u32> for Delay {
91
91
}
92
92
}
93
93
94
- impl hal :: blocking:: delay:: DelayUs < u64 > for Delay {
94
+ impl embedded_hal :: blocking:: delay:: DelayUs < u64 > for Delay {
95
95
type Error = Infallible ;
96
96
97
97
fn try_delay_us ( & mut self , n : u64 ) -> Result < ( ) , Self :: Error > {
@@ -103,7 +103,7 @@ impl hal::blocking::delay::DelayUs<u64> for Delay {
103
103
}
104
104
}
105
105
106
- impl hal :: blocking:: delay:: DelayMs < u8 > for Delay {
106
+ impl embedded_hal :: blocking:: delay:: DelayMs < u8 > for Delay {
107
107
type Error = Infallible ;
108
108
109
109
fn try_delay_ms ( & mut self , n : u8 ) -> Result < ( ) , Self :: Error > {
@@ -112,7 +112,7 @@ impl hal::blocking::delay::DelayMs<u8> for Delay {
112
112
}
113
113
}
114
114
115
- impl hal :: blocking:: delay:: DelayMs < u16 > for Delay {
115
+ impl embedded_hal :: blocking:: delay:: DelayMs < u16 > for Delay {
116
116
type Error = Infallible ;
117
117
118
118
fn try_delay_ms ( & mut self , n : u16 ) -> Result < ( ) , Self :: Error > {
@@ -121,7 +121,7 @@ impl hal::blocking::delay::DelayMs<u16> for Delay {
121
121
}
122
122
}
123
123
124
- impl hal :: blocking:: delay:: DelayMs < u32 > for Delay {
124
+ impl embedded_hal :: blocking:: delay:: DelayMs < u32 > for Delay {
125
125
type Error = Infallible ;
126
126
127
127
fn try_delay_ms ( & mut self , n : u32 ) -> Result < ( ) , Self :: Error > {
@@ -130,7 +130,7 @@ impl hal::blocking::delay::DelayMs<u32> for Delay {
130
130
}
131
131
}
132
132
133
- impl hal :: blocking:: delay:: DelayMs < u64 > for Delay {
133
+ impl embedded_hal :: blocking:: delay:: DelayMs < u64 > for Delay {
134
134
type Error = Infallible ;
135
135
136
136
fn try_delay_ms ( & mut self , n : u64 ) -> Result < ( ) , Self :: Error > {
@@ -173,7 +173,7 @@ impl I2cdev {
173
173
}
174
174
}
175
175
176
- impl hal :: blocking:: i2c:: Read for I2cdev {
176
+ impl embedded_hal :: blocking:: i2c:: Read for I2cdev {
177
177
type Error = i2cdev:: linux:: LinuxI2CError ;
178
178
179
179
fn try_read ( & mut self , address : u8 , buffer : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
@@ -182,7 +182,7 @@ impl hal::blocking::i2c::Read for I2cdev {
182
182
}
183
183
}
184
184
185
- impl hal :: blocking:: i2c:: Write for I2cdev {
185
+ impl embedded_hal :: blocking:: i2c:: Write for I2cdev {
186
186
type Error = i2cdev:: linux:: LinuxI2CError ;
187
187
188
188
fn try_write ( & mut self , address : u8 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
@@ -191,7 +191,7 @@ impl hal::blocking::i2c::Write for I2cdev {
191
191
}
192
192
}
193
193
194
- impl hal :: blocking:: i2c:: WriteRead for I2cdev {
194
+ impl embedded_hal :: blocking:: i2c:: WriteRead for I2cdev {
195
195
type Error = i2cdev:: linux:: LinuxI2CError ;
196
196
197
197
fn try_write_read (
@@ -240,7 +240,7 @@ impl Spidev {
240
240
}
241
241
}
242
242
243
- impl hal :: blocking:: spi:: Transfer < u8 > for Spidev {
243
+ impl embedded_hal :: blocking:: spi:: Transfer < u8 > for Spidev {
244
244
type Error = io:: Error ;
245
245
246
246
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 {
251
251
}
252
252
}
253
253
254
- impl hal :: blocking:: spi:: Write < u8 > for Spidev {
254
+ impl embedded_hal :: blocking:: spi:: Write < u8 > for Spidev {
255
255
type Error = io:: Error ;
256
256
257
257
fn try_write ( & mut self , buffer : & [ u8 ] ) -> io:: Result < ( ) > {
258
258
self . 0 . write_all ( buffer)
259
259
}
260
260
}
261
261
262
- pub use hal :: blocking:: spi:: { Operation as SpiOperation } ;
262
+ pub use embedded_hal :: blocking:: spi:: { Operation as SpiOperation } ;
263
263
264
264
/// 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 {
266
266
type Error = io:: Error ;
267
267
268
268
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 {
285
285
} ) . collect ( ) ;
286
286
287
287
// Execute transfer
288
- self . 0 . transfer_multiple ( & mut messages) ?;
289
-
290
- Ok ( ( ) )
288
+ self . 0 . transfer_multiple ( & mut messages)
291
289
}
292
290
}
293
291
0 commit comments