@@ -31,8 +31,7 @@ enum Function {
3131 Transmit ,
3232 /// Receive audio data
3333 Receive ,
34- #[ cfg( any( spi_v4, spi_v5) ) ]
35-
34+ #[ cfg( any( spi_v4, spi_v5, spi_v2_i2s) ) ]
3635 /// Transmit and Receive audio data
3736 FullDuplex ,
3837}
@@ -349,6 +348,38 @@ impl<'d, W: Word> I2S<'d, W> {
349348 )
350349 }
351350
351+ #[ cfg( spi_v2_i2s) ]
352+ /// Create a transmitter driver.
353+ pub fn new_full_duplex < T : I2sSExtInstance , D1 : TxDma < T > , D2 : RxDmaExt < T > , #[ cfg( afio) ] A > (
354+ peri : Peri < ' d , T > ,
355+ txsd : Peri < ' d , if_afio ! ( impl MosiPin <T , A >) > ,
356+ rxsd : Peri < ' d , if_afio ! ( impl SdExtPin <T , A >) > ,
357+ ws : Peri < ' d , if_afio ! ( impl WsPin <T , A >) > ,
358+ ck : Peri < ' d , if_afio ! ( impl CkPin <T , A >) > ,
359+ mck : Peri < ' d , if_afio ! ( impl MckPin <T , A >) > ,
360+ txdma : Peri < ' d , D1 > ,
361+ txdma_buf : & ' d mut [ W ] ,
362+ rxdma : Peri < ' d , D2 > ,
363+ rxdma_buf : & ' d mut [ W ] ,
364+ _irq : impl crate :: interrupt:: typelevel:: Binding < D1 :: Interrupt , crate :: dma:: InterruptHandler < D1 > >
365+ + crate :: interrupt:: typelevel:: Binding < D2 :: Interrupt , crate :: dma:: InterruptHandler < D2 > >
366+ + ' d ,
367+ config : Config ,
368+ ) -> Self {
369+ Self :: new_inner (
370+ peri,
371+ new_pin ! ( txsd, AfType :: output( OutputType :: PushPull , Speed :: VeryHigh ) ) ,
372+ new_pin ! ( rxsd, AfType :: output( OutputType :: PushPull , Speed :: VeryHigh ) ) ,
373+ ws,
374+ ck,
375+ new_pin ! ( mck, AfType :: output( OutputType :: PushPull , Speed :: VeryHigh ) ) ,
376+ new_dma ! ( txdma, _irq) . map ( |d| ( d, txdma_buf) ) ,
377+ new_dma ! ( rxdma, _irq) . map ( |d| ( d, rxdma_buf) ) ,
378+ config,
379+ Function :: FullDuplex ,
380+ )
381+ }
382+
352383 #[ cfg( any( spi_v4, spi_v5) ) ]
353384 /// Create a full duplex driver.
354385 pub fn new_full_duplex < T : Instance , D1 : TxDma < T > , D2 : RxDma < T > , #[ cfg( afio) ] A > (
@@ -644,6 +675,10 @@ impl<'d, W: Word> I2S<'d, W> {
644675 ( Mode :: Slave , Function :: Receive ) => I2scfg :: SLAVE_RX ,
645676 #[ cfg( any( spi_v4, spi_v5) ) ]
646677 ( Mode :: Slave , Function :: FullDuplex ) => I2scfg :: SLAVE_FULL_DUPLEX ,
678+ #[ cfg( spi_v2_i2s) ]
679+ ( Mode :: Master , Function :: FullDuplex ) => todo ! ( ) ,
680+ #[ cfg( spi_v2_i2s) ]
681+ ( Mode :: Slave , Function :: FullDuplex ) => todo ! ( ) ,
647682 } ) ;
648683 } ) ;
649684
@@ -782,6 +817,9 @@ fn reset_incompatible_bitfields<T: Instance>() {
782817 regs. udrdr ( ) . write ( |w| w. 0 = 0 ) ;
783818}
784819
820+ dma_trait ! ( RxDmaExt , I2sSExtInstance ) ;
821+ pin_trait ! ( SdExtPin , I2sSExtInstance ) ;
822+
785823/// Full-Duplex I2s Instance
786824pub trait I2sSExtInstance : spi:: Instance {
787825 /// Ext regs
0 commit comments