@@ -71,23 +71,25 @@ pub struct DmaInterrupts {
7171}
7272
7373/// Alias for a tuple with all DMA channels.
74- pub struct ChannelsTuple < T > (
75- pub Channel1 < T > ,
76- pub Channel2 < T > ,
77- pub Channel3 < T > ,
78- pub Channel4 < T > ,
79- pub Channel5 < T > ,
80- pub Channel6 < T > ,
81- #[ cfg( not( any( feature = "stm32g431" , feature = "stm32g441" , ) ) ) ] pub Channel7 < T > ,
82- #[ cfg( not( any( feature = "stm32g431" , feature = "stm32g441" , ) ) ) ] pub Channel8 < T > ,
83- ) ;
74+ pub struct Channels < T > {
75+ pub ch1 : Channel1 < T > ,
76+ pub ch2 : Channel2 < T > ,
77+ pub ch3 : Channel3 < T > ,
78+ pub ch4 : Channel4 < T > ,
79+ pub ch5 : Channel5 < T > ,
80+ pub ch6 : Channel6 < T > ,
81+ #[ cfg( not( any( feature = "stm32g431" , feature = "stm32g441" , ) ) ) ]
82+ pub ch7 : Channel7 < T > ,
83+ #[ cfg( not( any( feature = "stm32g431" , feature = "stm32g441" , ) ) ) ]
84+ pub ch8 : Channel8 < T > ,
85+ }
8486
8587pub trait DMAExt < I > {
86- fn split ( self , rcc : & Rcc ) -> ChannelsTuple < I > ;
88+ fn split ( self , rcc : & Rcc ) -> Channels < I > ;
8789}
8890
8991impl DMAExt < Self > for DMA1 {
90- fn split ( self , rcc : & Rcc ) -> ChannelsTuple < DMA1 > {
92+ fn split ( self , rcc : & Rcc ) -> Channels < DMA1 > {
9193 // Enable DMAMux is not yet enabled
9294 if !rcc. rb . ahb1enr ( ) . read ( ) . dmamuxen ( ) . bit_is_set ( ) {
9395 // Enable peripheral
@@ -97,12 +99,12 @@ impl DMAExt<Self> for DMA1 {
9799 // Enable peripheral
98100 rcc. rb . ahb1enr ( ) . modify ( |_, w| w. dma1en ( ) . set_bit ( ) ) ;
99101
100- ChannelsTuple :: new ( self )
102+ Channels :: new ( self )
101103 }
102104}
103105
104106impl DMAExt < Self > for DMA2 {
105- fn split ( self , rcc : & Rcc ) -> ChannelsTuple < DMA2 > {
107+ fn split ( self , rcc : & Rcc ) -> Channels < DMA2 > {
106108 // Enable DMAMux is not yet enabled
107109 if !rcc. rb . ahb1enr ( ) . read ( ) . dmamuxen ( ) . bit_is_set ( ) {
108110 // Enable peripheral
@@ -112,25 +114,25 @@ impl DMAExt<Self> for DMA2 {
112114 // Enable peripheral
113115 rcc. rb . ahb1enr ( ) . modify ( |_, w| w. dma2en ( ) . set_bit ( ) ) ;
114116
115- ChannelsTuple :: new ( self )
117+ Channels :: new ( self )
116118 }
117119}
118120
119- impl < I : Instance > ChannelsTuple < I > {
121+ impl < I : Instance > Channels < I > {
120122 /// Splits the DMA peripheral into channels.
121123 pub ( crate ) fn new ( _regs : I ) -> Self {
122- Self (
123- Channel1 { _dma : PhantomData } ,
124- Channel2 { _dma : PhantomData } ,
125- Channel3 { _dma : PhantomData } ,
126- Channel4 { _dma : PhantomData } ,
127- Channel5 { _dma : PhantomData } ,
128- Channel6 { _dma : PhantomData } ,
124+ Self {
125+ ch1 : Channel1 { _dma : PhantomData } ,
126+ ch2 : Channel2 { _dma : PhantomData } ,
127+ ch3 : Channel3 { _dma : PhantomData } ,
128+ ch4 : Channel4 { _dma : PhantomData } ,
129+ ch5 : Channel5 { _dma : PhantomData } ,
130+ ch6 : Channel6 { _dma : PhantomData } ,
129131 #[ cfg( not( any( feature = "stm32g431" , feature = "stm32g441" , ) ) ) ]
130- Channel7 { _dma : PhantomData } ,
132+ ch7 : Channel7 { _dma : PhantomData } ,
131133 #[ cfg( not( any( feature = "stm32g431" , feature = "stm32g441" , ) ) ) ]
132- Channel8 { _dma : PhantomData } ,
133- )
134+ ch8 : Channel8 { _dma : PhantomData } ,
135+ }
134136 }
135137}
136138
0 commit comments