@@ -29,81 +29,6 @@ pub trait WriteIter<W> {
2929 WI : IntoIterator < Item = W > ;
3030}
3131
32- /// Blocking transfer
33- pub mod transfer {
34- /// Default implementation of `blocking::spi::Transfer<W>` for implementers of
35- /// `nonblocking::spi::FullDuplex<W>`
36- pub trait Default < W > : crate :: nb:: spi:: FullDuplex < W > { }
37-
38- impl < W , S > crate :: blocking:: spi:: Transfer < W > for S
39- where
40- S : Default < W > ,
41- W : Clone ,
42- {
43- type Error = S :: Error ;
44-
45- fn transfer < ' w > ( & mut self , words : & ' w mut [ W ] ) -> Result < & ' w [ W ] , S :: Error > {
46- for word in words. iter_mut ( ) {
47- nb:: block!( self . write( word. clone( ) ) ) ?;
48- * word = nb:: block!( self . read( ) ) ?;
49- }
50-
51- Ok ( words)
52- }
53- }
54- }
55-
56- /// Blocking write
57- pub mod write {
58- /// Default implementation of `blocking::spi::Write<W>` for implementers
59- /// of `nonblocking::spi::FullDuplex<W>`
60- pub trait Default < W > : crate :: nb:: spi:: FullDuplex < W > { }
61-
62- impl < W , S > crate :: blocking:: spi:: Write < W > for S
63- where
64- S : Default < W > ,
65- W : Clone ,
66- {
67- type Error = S :: Error ;
68-
69- fn write ( & mut self , words : & [ W ] ) -> Result < ( ) , S :: Error > {
70- for word in words {
71- nb:: block!( self . write( word. clone( ) ) ) ?;
72- nb:: block!( self . read( ) ) ?;
73- }
74-
75- Ok ( ( ) )
76- }
77- }
78- }
79-
80- /// Blocking write (iterator version)
81- pub mod write_iter {
82- /// Default implementation of `blocking::spi::WriteIter<W>` for implementers of
83- /// `nonblocking::spi::FullDuplex<W>`
84- pub trait Default < W > : crate :: nb:: spi:: FullDuplex < W > { }
85-
86- impl < W , S > crate :: blocking:: spi:: WriteIter < W > for S
87- where
88- S : Default < W > ,
89- W : Clone ,
90- {
91- type Error = S :: Error ;
92-
93- fn write_iter < WI > ( & mut self , words : WI ) -> Result < ( ) , S :: Error >
94- where
95- WI : IntoIterator < Item = W > ,
96- {
97- for word in words. into_iter ( ) {
98- nb:: block!( self . write( word. clone( ) ) ) ?;
99- nb:: block!( self . read( ) ) ?;
100- }
101-
102- Ok ( ( ) )
103- }
104- }
105- }
106-
10732/// Operation for transactional SPI trait
10833///
10934/// This allows composition of SPI operations into a single bus transaction
@@ -124,31 +49,3 @@ pub trait Transactional<W: 'static> {
12449 /// Execute the provided transactions
12550 fn exec < ' a > ( & mut self , operations : & mut [ Operation < ' a , W > ] ) -> Result < ( ) , Self :: Error > ;
12651}
127-
128- /// Blocking transactional impl over spi::Write and spi::Transfer
129- pub mod transactional {
130- use super :: { Operation , Transfer , Write } ;
131-
132- /// Default implementation of `blocking::spi::Transactional<W>` for implementers of
133- /// `spi::Write<W>` and `spi::Transfer<W>`
134- pub trait Default < W > : Write < W > + Transfer < W > { }
135-
136- impl < W : ' static , E , S > super :: Transactional < W > for S
137- where
138- S : self :: Default < W > + Write < W , Error = E > + Transfer < W , Error = E > ,
139- W : Copy + Clone ,
140- {
141- type Error = E ;
142-
143- fn exec < ' a > ( & mut self , operations : & mut [ super :: Operation < ' a , W > ] ) -> Result < ( ) , E > {
144- for op in operations {
145- match op {
146- Operation :: Write ( w) => self . write ( w) ?,
147- Operation :: Transfer ( t) => self . transfer ( t) . map ( |_| ( ) ) ?,
148- }
149- }
150-
151- Ok ( ( ) )
152- }
153- }
154- }
0 commit comments