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