@@ -58,16 +58,21 @@ async fn interrupt_driven_task(spi: esp_hal::spi::master::SpiDma<'static, Blocki
5858
5959#[ cfg( not( any( esp32, esp32s2, esp32s3) ) ) ]
6060#[ embassy_executor:: task]
61- async fn interrupt_driven_task ( i2s_tx : esp_hal:: i2s:: master:: I2s < ' static , Blocking > ) {
62- let ( _, _, _, tx_descriptors) = dma_buffers ! ( 128 ) ;
61+ async fn interrupt_driven_task_2 ( i2s_tx : esp_hal:: i2s:: master:: I2s < ' static , Blocking > ) {
62+ use esp_hal:: dma:: DmaTxStreamBuf ;
63+ let ( _, _, tx_buffer, tx_descriptors) = dma_buffers ! ( 128 ) ;
6364
64- let mut i2s_tx = i2s_tx. into_async ( ) . i2s_tx . build ( tx_descriptors) ;
65+ let i2s_tx = i2s_tx. into_async ( ) . i2s_tx . build ( ) ;
66+ let mut transfer = i2s_tx
67+ . write ( DmaTxStreamBuf :: new ( tx_descriptors, tx_buffer) . unwrap ( ) )
68+ . unwrap ( ) ;
6569
6670 loop {
6771 let mut buffer: [ u8 ; 8 ] = [ 0 ; 8 ] ;
6872
6973 INTERRUPT_TASK_WORKING . store ( true , portable_atomic:: Ordering :: Relaxed ) ;
70- i2s_tx. write_dma_async ( & mut buffer) . await . unwrap ( ) ;
74+ transfer. wait_for_available ( ) . await . unwrap ( ) ;
75+ transfer. push ( & mut buffer) ;
7176 INTERRUPT_TASK_WORKING . store ( false , portable_atomic:: Ordering :: Relaxed ) ;
7277
7378 if STOP_INTERRUPT_TASK . load ( portable_atomic:: Ordering :: Relaxed ) {
0 commit comments