File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
### Changed
12
12
- Changed ` ErrorKind::I2cNoAck ` to have an inner type of ` eh1::i2c::NoAcknowledgeSource ` .
13
13
14
+ ### Fixed
15
+ - Fixed asymmetric SPI transfers (read size > write size) with ` eh1 ` .
16
+
14
17
## [ 0.17.0] - 2023-08-15
15
18
### Changed
16
19
- Updated the alpha release of ` embedded-hal ` from ` 1.0.0-alpha.11 ` to ` 1.0.0-rc.1 ` .
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ fn main() {
44
44
// bytes are still in the read buffer, which breaks tests afterwards.
45
45
// Spi::flush(&mut spi) doesn't help either
46
46
47
- /*
48
47
// --- Asymmetric transfer (Read more than we write) ---
49
48
print ! ( "Starting asymetric transfer (read > write)..." ) ;
50
49
let mut read: [ u8 ; 4 ] = [ 0x00 ; 4 ] ;
@@ -55,7 +54,6 @@ fn main() {
55
54
assert_eq ! ( read[ 2 ] , 0x00u8 ) ;
56
55
println ! ( " SUCCESS" ) ;
57
56
sleep ( delay) ;
58
- */
59
57
60
58
// --- Symmetric transfer with huge buffer ---
61
59
// Only your RAM is the limit!
Original file line number Diff line number Diff line change @@ -279,6 +279,12 @@ where
279
279
lock. ft . send ( cmd. as_slice ( ) ) ?;
280
280
lock. ft . recv ( read) ?;
281
281
282
+ let remain: usize = write. len ( ) . saturating_sub ( read. len ( ) ) ;
283
+ if remain != 0 {
284
+ let mut remain_buf: Vec < u8 > = vec ! [ 0 ; remain] ;
285
+ lock. ft . recv ( & mut remain_buf) ?;
286
+ }
287
+
282
288
Ok ( ( ) )
283
289
}
284
290
}
You can’t perform that action at this time.
0 commit comments