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 1
1
use super :: * ;
2
- #[ cfg( feature = "uart4" ) ]
3
- use crate :: uart;
4
2
use crate :: {
5
3
pac:: { self , DMA1 , DMA2 } ,
6
4
timer,
Original file line number Diff line number Diff line change @@ -831,26 +831,22 @@ pub struct Rx<SPI> {
831
831
832
832
impl < SPI : Instance > DmaBuilder < SPI > {
833
833
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 > {
846
834
self . spi . cr2 . modify ( |_, w| w. txdmaen ( ) . enabled ( ) ) ;
847
835
Tx { spi : PhantomData }
848
836
}
849
837
850
- fn new_rx ( self ) -> Rx < SPI > {
838
+ pub fn rx ( self ) -> Rx < SPI > {
851
839
self . spi . cr2 . modify ( |_, w| w. rxdmaen ( ) . enabled ( ) ) ;
852
840
Rx { spi : PhantomData }
853
841
}
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
+ }
854
850
}
855
851
856
852
unsafe impl < SPI : Instance > PeriAddress for Rx < SPI > {
You can’t perform that action at this time.
0 commit comments