File tree Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change 11use super :: * ;
2- #[ cfg( feature = "uart4" ) ]
3- use crate :: uart;
42use crate :: {
53 pac:: { self , DMA1 , DMA2 } ,
64 timer,
Original file line number Diff line number Diff line change @@ -831,26 +831,22 @@ pub struct Rx<SPI> {
831831
832832impl < SPI : Instance > DmaBuilder < SPI > {
833833 pub fn tx ( self ) -> Tx < SPI > {
834- self . new_tx ( )
835- }
836-
837- pub fn rx ( self ) -> Rx < SPI > {
838- self . new_rx ( )
839- }
840-
841- pub fn txrx ( self ) -> ( Tx < SPI > , Rx < SPI > ) {
842- ( self . new_tx ( ) , self . new_rx ( ) )
843- }
844-
845- fn new_tx ( & self ) -> Tx < SPI > {
846834 self . spi . cr2 . modify ( |_, w| w. txdmaen ( ) . enabled ( ) ) ;
847835 Tx { spi : PhantomData }
848836 }
849837
850- fn new_rx ( self ) -> Rx < SPI > {
838+ pub fn rx ( self ) -> Rx < SPI > {
851839 self . spi . cr2 . modify ( |_, w| w. rxdmaen ( ) . enabled ( ) ) ;
852840 Rx { spi : PhantomData }
853841 }
842+
843+ pub fn txrx ( self ) -> ( Tx < SPI > , Rx < SPI > ) {
844+ self . spi . cr2 . modify ( |_, w| {
845+ w. txdmaen ( ) . enabled ( ) ;
846+ w. rxdmaen ( ) . enabled ( )
847+ } ) ;
848+ ( Tx { spi : PhantomData } , Rx { spi : PhantomData } )
849+ }
854850}
855851
856852unsafe impl < SPI : Instance > PeriAddress for Rx < SPI > {
You can’t perform that action at this time.
0 commit comments