@@ -19,19 +19,32 @@ pub trait Read<W = u8>: Spi {
19
19
/// The word value sent on MOSI during reading is implementation-defined,
20
20
/// typically `0x00`, `0xFF`, or configurable.
21
21
fn read ( & mut self , words : & mut [ W ] ) -> Result < ( ) , Self :: Error > ;
22
+
23
+ /// Reads all slices in `words` from the slave as part of a single SPI transaction.
24
+ ///
25
+ /// The word value sent on MOSI during reading is implementation-defined,
26
+ /// typically `0x00`, `0xFF`, or configurable.
27
+ fn read_batch ( & mut self , words : & mut [ & mut [ W ] ] ) -> Result < ( ) , Self :: Error > ;
22
28
}
23
29
24
30
impl < T : Read < W > , W > Read < W > for & mut T {
25
31
fn read ( & mut self , words : & mut [ W ] ) -> Result < ( ) , Self :: Error > {
26
32
T :: read ( self , words)
27
33
}
34
+
35
+ fn read_batch ( & mut self , words : & mut [ & mut [ W ] ] ) -> Result < ( ) , Self :: Error > {
36
+ T :: read_batch ( self , words)
37
+ }
28
38
}
29
39
30
40
/// Blocking write-only SPI
31
41
pub trait Write < W = u8 > : Spi {
32
42
/// Writes `words` to the slave, ignoring all the incoming words
33
43
fn write ( & mut self , words : & [ W ] ) -> Result < ( ) , Self :: Error > ;
34
44
45
+ /// Writes all slices in `words` to the slave as part of a single SPI transaction, ignoring all the incoming words
46
+ fn write_batch ( & mut self , words : & [ & [ W ] ] ) -> Result < ( ) , Self :: Error > ;
47
+
35
48
/// Writes `words` to the slave, ignoring all the incoming words
36
49
fn write_iter < WI > ( & mut self , words : WI ) -> Result < ( ) , Self :: Error >
37
50
where
@@ -43,6 +56,10 @@ impl<T: Write<W>, W> Write<W> for &mut T {
43
56
T :: write ( self , words)
44
57
}
45
58
59
+ fn write_batch ( & mut self , words : & [ & [ W ] ] ) -> Result < ( ) , Self :: Error > {
60
+ T :: write_batch ( self , words)
61
+ }
62
+
46
63
fn write_iter < WI > ( & mut self , words : WI ) -> Result < ( ) , Self :: Error >
47
64
where
48
65
WI : IntoIterator < Item = W > ,
0 commit comments