@@ -39,7 +39,13 @@ pub trait Write<W>: Spi {
39
39
/// Writes `words` to the slave, ignoring all the incoming words
40
40
fn write_iter < WI > ( & mut self , words : WI ) -> Result < ( ) , Self :: Error >
41
41
where
42
- WI : IntoIterator < Item = W > ;
42
+ WI : IntoIterator < Item = W > ,
43
+ {
44
+ for word in words {
45
+ self . write ( & [ word] ) ?;
46
+ }
47
+ Ok ( ( ) )
48
+ }
43
49
}
44
50
45
51
impl < T : Write < W > , W > Write < W > for & mut T {
@@ -88,7 +94,17 @@ pub trait ReadWrite<W>: Read<W> + Write<W> {
88
94
fn transfer_inplace ( & mut self , words : & mut [ W ] ) -> Result < ( ) , Self :: Error > ;
89
95
90
96
/// Execute multiple actions as part of a single SPI transaction
91
- fn exec < ' a > ( & mut self , operations : & mut [ Operation < ' a , W > ] ) -> Result < ( ) , Self :: Error > ;
97
+ fn exec < ' a > ( & mut self , operations : & mut [ Operation < ' a , W > ] ) -> Result < ( ) , Self :: Error > {
98
+ for op in operations {
99
+ match op {
100
+ Operation :: Read ( words) => self . read ( words) ?,
101
+ Operation :: Write ( words) => self . write ( words) ?,
102
+ Operation :: Transfer ( read, write) => self . transfer ( read, write) ?,
103
+ Operation :: TransferInplace ( words) => self . transfer_inplace ( words) ?,
104
+ }
105
+ }
106
+ Ok ( ( ) )
107
+ }
92
108
}
93
109
94
110
impl < T : ReadWrite < W > , W > ReadWrite < W > for & mut T {
0 commit comments