File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -104,3 +104,24 @@ pub mod write_iter {
104
104
}
105
105
}
106
106
}
107
+
108
+ /// Operation for transactional SPI trait
109
+ ///
110
+ /// This allows composition of SPI operations into a single bus transaction
111
+ #[ derive( Debug , PartialEq ) ]
112
+ pub enum Operation < ' a , W : ' static > {
113
+ /// Write data from the provided buffer, discarding read data
114
+ Write ( & ' a [ W ] ) ,
115
+ /// Write data out while reading data into the provided buffer
116
+ Transfer ( & ' a mut [ W ] ) ,
117
+ }
118
+
119
+ /// Transactional trait allows multiple actions to be executed
120
+ /// as part of a single SPI transaction
121
+ pub trait Transactional < W : ' static > {
122
+ /// Associated error type
123
+ type Error ;
124
+
125
+ /// Execute the provided transactions
126
+ fn exec < ' a > ( & mut self , operations : & mut [ Operation < ' a , W > ] ) -> Result < ( ) , Self :: Error > ;
127
+ }
You can’t perform that action at this time.
0 commit comments