@@ -26,6 +26,7 @@ pub trait SpiDevice<Word: Copy + 'static = u8>: ErrorType {
26
26
///
27
27
/// On bus errors the implementation should try to deassert CS.
28
28
/// If an error occurs while deasserting CS the bus error should take priority as the return value.
29
+ #[ allow( async_fn_in_trait) ]
29
30
async fn transaction (
30
31
& mut self ,
31
32
operations : & mut [ Operation < ' _ , Word > ] ,
@@ -37,6 +38,7 @@ pub trait SpiDevice<Word: Copy + 'static = u8>: ErrorType {
37
38
///
38
39
/// See also: [`SpiDevice::transaction`], [`SpiDevice::read`]
39
40
#[ inline]
41
+ #[ allow( async_fn_in_trait) ]
40
42
async fn read ( & mut self , buf : & mut [ Word ] ) -> Result < ( ) , Self :: Error > {
41
43
self . transaction ( & mut [ Operation :: Read ( buf) ] ) . await
42
44
}
@@ -47,6 +49,7 @@ pub trait SpiDevice<Word: Copy + 'static = u8>: ErrorType {
47
49
///
48
50
/// See also: [`SpiDevice::transaction`], [`SpiDevice::write`]
49
51
#[ inline]
52
+ #[ allow( async_fn_in_trait) ]
50
53
async fn write ( & mut self , buf : & [ Word ] ) -> Result < ( ) , Self :: Error > {
51
54
self . transaction ( & mut [ Operation :: Write ( buf) ] ) . await
52
55
}
@@ -57,6 +60,7 @@ pub trait SpiDevice<Word: Copy + 'static = u8>: ErrorType {
57
60
///
58
61
/// See also: [`SpiDevice::transaction`], [`SpiBus::transfer`]
59
62
#[ inline]
63
+ #[ allow( async_fn_in_trait) ]
60
64
async fn transfer ( & mut self , read : & mut [ Word ] , write : & [ Word ] ) -> Result < ( ) , Self :: Error > {
61
65
self . transaction ( & mut [ Operation :: Transfer ( read, write) ] )
62
66
. await
@@ -68,6 +72,7 @@ pub trait SpiDevice<Word: Copy + 'static = u8>: ErrorType {
68
72
///
69
73
/// See also: [`SpiDevice::transaction`], [`SpiBus::transfer_in_place`]
70
74
#[ inline]
75
+ #[ allow( async_fn_in_trait) ]
71
76
async fn transfer_in_place ( & mut self , buf : & mut [ Word ] ) -> Result < ( ) , Self :: Error > {
72
77
self . transaction ( & mut [ Operation :: TransferInPlace ( buf) ] )
73
78
. await
@@ -76,6 +81,7 @@ pub trait SpiDevice<Word: Copy + 'static = u8>: ErrorType {
76
81
77
82
impl < Word : Copy + ' static , T : SpiDevice < Word > + ?Sized > SpiDevice < Word > for & mut T {
78
83
#[ inline]
84
+ #[ allow( async_fn_in_trait) ]
79
85
async fn transaction (
80
86
& mut self ,
81
87
operations : & mut [ Operation < ' _ , Word > ] ,
@@ -84,21 +90,25 @@ impl<Word: Copy + 'static, T: SpiDevice<Word> + ?Sized> SpiDevice<Word> for &mut
84
90
}
85
91
86
92
#[ inline]
93
+ #[ allow( async_fn_in_trait) ]
87
94
async fn read ( & mut self , buf : & mut [ Word ] ) -> Result < ( ) , Self :: Error > {
88
95
T :: read ( self , buf) . await
89
96
}
90
97
91
98
#[ inline]
99
+ #[ allow( async_fn_in_trait) ]
92
100
async fn write ( & mut self , buf : & [ Word ] ) -> Result < ( ) , Self :: Error > {
93
101
T :: write ( self , buf) . await
94
102
}
95
103
96
104
#[ inline]
105
+ #[ allow( async_fn_in_trait) ]
97
106
async fn transfer ( & mut self , read : & mut [ Word ] , write : & [ Word ] ) -> Result < ( ) , Self :: Error > {
98
107
T :: transfer ( self , read, write) . await
99
108
}
100
109
101
110
#[ inline]
111
+ #[ allow( async_fn_in_trait) ]
102
112
async fn transfer_in_place ( & mut self , buf : & mut [ Word ] ) -> Result < ( ) , Self :: Error > {
103
113
T :: transfer_in_place ( self , buf) . await
104
114
}
@@ -117,12 +127,14 @@ pub trait SpiBus<Word: 'static + Copy = u8>: ErrorType {
117
127
///
118
128
/// Implementations are allowed to return before the operation is
119
129
/// complete. See [the docs on embedded-hal][embedded_hal::spi] for details on flushing.
130
+ #[ allow( async_fn_in_trait) ]
120
131
async fn read ( & mut self , words : & mut [ Word ] ) -> Result < ( ) , Self :: Error > ;
121
132
122
133
/// Write `words` to the slave, ignoring all the incoming words.
123
134
///
124
135
/// Implementations are allowed to return before the operation is
125
136
/// complete. See [the docs on embedded-hal][embedded_hal::spi] for details on flushing.
137
+ #[ allow( async_fn_in_trait) ]
126
138
async fn write ( & mut self , words : & [ Word ] ) -> Result < ( ) , Self :: Error > ;
127
139
128
140
/// Write and read simultaneously. `write` is written to the slave on MOSI and
@@ -136,6 +148,7 @@ pub trait SpiBus<Word: 'static + Copy = u8>: ErrorType {
136
148
///
137
149
/// Implementations are allowed to return before the operation is
138
150
/// complete. See [the docs on embedded-hal][embedded_hal::spi] for details on flushing.
151
+ #[ allow( async_fn_in_trait) ]
139
152
async fn transfer ( & mut self , read : & mut [ Word ] , write : & [ Word ] ) -> Result < ( ) , Self :: Error > ;
140
153
141
154
/// Write and read simultaneously. The contents of `words` are
@@ -144,36 +157,43 @@ pub trait SpiBus<Word: 'static + Copy = u8>: ErrorType {
144
157
///
145
158
/// Implementations are allowed to return before the operation is
146
159
/// complete. See [the docs on embedded-hal][embedded_hal::spi] for details on flushing.
160
+ #[ allow( async_fn_in_trait) ]
147
161
async fn transfer_in_place ( & mut self , words : & mut [ Word ] ) -> Result < ( ) , Self :: Error > ;
148
162
149
163
/// Wait until all operations have completed and the bus is idle.
150
164
///
151
165
/// See [the docs on embedded-hal][embedded_hal::spi] for information on flushing.
166
+ #[ allow( async_fn_in_trait) ]
152
167
async fn flush ( & mut self ) -> Result < ( ) , Self :: Error > ;
153
168
}
154
169
155
170
impl < T : SpiBus < Word > + ?Sized , Word : ' static + Copy > SpiBus < Word > for & mut T {
156
171
#[ inline]
172
+ #[ allow( async_fn_in_trait) ]
157
173
async fn read ( & mut self , words : & mut [ Word ] ) -> Result < ( ) , Self :: Error > {
158
174
T :: read ( self , words) . await
159
175
}
160
176
161
177
#[ inline]
178
+ #[ allow( async_fn_in_trait) ]
162
179
async fn write ( & mut self , words : & [ Word ] ) -> Result < ( ) , Self :: Error > {
163
180
T :: write ( self , words) . await
164
181
}
165
182
166
183
#[ inline]
184
+ #[ allow( async_fn_in_trait) ]
167
185
async fn transfer ( & mut self , read : & mut [ Word ] , write : & [ Word ] ) -> Result < ( ) , Self :: Error > {
168
186
T :: transfer ( self , read, write) . await
169
187
}
170
188
171
189
#[ inline]
190
+ #[ allow( async_fn_in_trait) ]
172
191
async fn transfer_in_place ( & mut self , words : & mut [ Word ] ) -> Result < ( ) , Self :: Error > {
173
192
T :: transfer_in_place ( self , words) . await
174
193
}
175
194
176
195
#[ inline]
196
+ #[ allow( async_fn_in_trait) ]
177
197
async fn flush ( & mut self ) -> Result < ( ) , Self :: Error > {
178
198
T :: flush ( self ) . await
179
199
}
0 commit comments