File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,11 @@ edition = "2018"
12
12
[features ]
13
13
gpio_sysfs = [" sysfs_gpio" ]
14
14
gpio_cdev = [" gpio-cdev" ]
15
- transactional-spi = [] # Guard for transactional SPI feature (https://github.com/rust-embedded/embedded-hal/pull/191)
16
15
17
16
default = [ " gpio_cdev" , " gpio_sysfs" ]
18
17
19
18
[dependencies ]
20
- embedded-hal = " =1.0.0-alpha.1 "
19
+ embedded-hal = " =1.0.0-alpha.2 "
21
20
gpio-cdev = { version = " 0.3" , optional = true }
22
21
sysfs_gpio = { version = " 0.5" , optional = true }
23
22
@@ -36,4 +35,5 @@ default-features = false
36
35
version = " 0.2.2"
37
36
38
37
[patch .crates-io ]
39
- # embedded-hal = { git = "https://github.com/ryankurte/embedded-hal", branch = "feature/spi-transactions" }
38
+ embedded-hal = { git = " https://github.com/rust-embedded/embedded-hal" }
39
+
Original file line number Diff line number Diff line change @@ -259,10 +259,9 @@ impl hal::blocking::spi::Write<u8> for Spidev {
259
259
}
260
260
}
261
261
262
- #[ cfg( feature = "transactional-spi" ) ]
263
262
pub use hal:: blocking:: spi:: { Operation as SpiOperation } ;
264
263
265
- # [ cfg ( feature = "transactional-spi" ) ]
264
+ /// Transactional implementation batches SPI operations into a single transaction
266
265
impl hal:: blocking:: spi:: Transactional < u8 > for Spidev {
267
266
type Error = io:: Error ;
268
267
@@ -273,9 +272,8 @@ impl hal::blocking::spi::Transactional<u8> for Spidev {
273
272
match a {
274
273
SpiOperation :: Write ( w) => SpidevTransfer :: write ( w) ,
275
274
SpiOperation :: Transfer ( r) => {
276
- // TODO: is spidev okay with the same array pointer
277
- // being used twice? If not, need some kind of vector
278
- // pool that will outlive the transfer
275
+ // Clone read to write pointer
276
+ // SPIdev is okay with having w == r but this is tricky to achieve in safe rust
279
277
let w = unsafe {
280
278
let p = r. as_ptr ( ) ;
281
279
std:: slice:: from_raw_parts ( p, r. len ( ) )
You can’t perform that action at this time.
0 commit comments