@@ -13,7 +13,7 @@ use futures_util::task::AtomicWaker;
13
13
use crate :: {
14
14
gpdma:: {
15
15
config:: DmaConfig ,
16
- periph:: { DmaDuplex , DmaRx , DmaTx , Rx , RxAddr , Tx , TxAddr } ,
16
+ periph:: { DmaDuplex , DmaRx , DmaTx , RxAddr , TxAddr } ,
17
17
DmaChannel , DmaTransfer , Error as DmaError , Word as DmaWord ,
18
18
} ,
19
19
interrupt,
@@ -222,16 +222,16 @@ where
222
222
}
223
223
224
224
#[ allow( private_bounds) ]
225
- impl < SPI , MODE , W > SpiDma < SPI , MODE , W >
225
+ impl < SPI , CH , W > SpiDma < SPI , DmaRx < SPI , W , CH > , W >
226
226
where
227
227
SPI : Instance + Waker ,
228
228
W : Word + DmaWord ,
229
- MODE : Rx < W > ,
229
+ CH : DmaChannel ,
230
230
{
231
231
pub fn start_dma_read < ' a , D > (
232
232
& ' a mut self ,
233
233
mut destination : D ,
234
- ) -> Result < DmaTransfer < ' a , < MODE as Rx < W > > :: CH > , Error >
234
+ ) -> Result < DmaTransfer < ' a , CH > , Error >
235
235
where
236
236
D : WriteBuffer < Word = W > ,
237
237
{
@@ -243,7 +243,7 @@ where
243
243
self . setup_read_mode ( ) ?;
244
244
245
245
let spi = & mut self . spi ;
246
- let transfer = self . mode . init_rx_transfer ( config, destination) ;
246
+ let mut transfer = self . mode . init_rx_transfer ( config, destination) ;
247
247
248
248
spi. inner . enable_rx_dma ( ) ;
249
249
@@ -264,16 +264,16 @@ where
264
264
}
265
265
266
266
#[ allow( private_bounds) ]
267
- impl < SPI , MODE , W > SpiDma < SPI , MODE , W >
267
+ impl < SPI , CH , W > SpiDma < SPI , DmaTx < SPI , W , CH > , W >
268
268
where
269
269
SPI : Instance + Waker ,
270
270
W : Word + DmaWord ,
271
- MODE : Tx < W > ,
271
+ CH : DmaChannel ,
272
272
{
273
273
pub fn start_dma_write < ' a , S > (
274
274
& ' a mut self ,
275
275
source : S ,
276
- ) -> Result < DmaTransfer < ' a , < MODE as Tx < W > > :: CH > , Error >
276
+ ) -> Result < DmaTransfer < ' a , CH > , Error >
277
277
where
278
278
S : ReadBuffer < Word = W > ,
279
279
{
@@ -287,7 +287,7 @@ where
287
287
self . setup_write_mode ( ) ?;
288
288
289
289
let spi = & mut self . spi ;
290
- let transfer = self . mode . init_tx_transfer ( config, source) ;
290
+ let mut transfer = self . mode . init_tx_transfer ( config, source) ;
291
291
292
292
transfer. start_nonblocking ( ) ;
293
293
spi. inner . enable_tx_dma ( ) ;
@@ -338,8 +338,9 @@ where
338
338
self . check_transfer_mode ( ) ?;
339
339
340
340
let spi = & mut self . spi ;
341
- let tx_transfer = self . mode . init_tx_transfer ( tx_config, source) ;
342
- let rx_transfer = self . mode . init_rx_transfer ( rx_config, destination) ;
341
+ let ( mut tx_transfer, mut rx_transfer) = self
342
+ . mode
343
+ . init_duplex_transfer ( tx_config, rx_config, source, destination) ;
343
344
344
345
spi. inner . enable_rx_dma ( ) ;
345
346
rx_transfer. start_nonblocking ( ) ;
0 commit comments