@@ -144,32 +144,32 @@ macro_rules! dma {
144144 ///
145145 /// `inc` indicates whether the address will be incremented after every byte transfer
146146 pub fn set_peripheral_address( & mut self , address: u32 , inc: bool ) {
147- self . ch( ) . par. write( |w| unsafe { w. pa( ) . bits( address) } ) ;
148- self . ch( ) . cr. modify( |_, w| w. pinc( ) . bit( inc) ) ;
147+ self . ch( ) . par( ) . write( |w| unsafe { w. pa( ) . bits( address) } ) ;
148+ self . ch( ) . cr( ) . modify( |_, w| w. pinc( ) . bit( inc) ) ;
149149 }
150150
151151 /// `address` where from/to data will be read/write
152152 ///
153153 /// `inc` indicates whether the address will be incremented after every byte transfer
154154 pub fn set_memory_address( & mut self , address: u32 , inc: bool ) {
155- self . ch( ) . mar. write( |w| unsafe { w. ma( ) . bits( address) } ) ;
156- self . ch( ) . cr. modify( |_, w| w. minc( ) . bit( inc) ) ;
155+ self . ch( ) . mar( ) . write( |w| unsafe { w. ma( ) . bits( address) } ) ;
156+ self . ch( ) . cr( ) . modify( |_, w| w. minc( ) . bit( inc) ) ;
157157 }
158158
159159 /// Number of bytes to transfer
160160 pub fn set_transfer_length( & mut self , len: usize ) {
161- self . ch( ) . ndtr. write( |w| w. ndt( ) . bits ( u16 :: try_from( len) . unwrap( ) ) ) ;
161+ self . ch( ) . ndtr( ) . write( |w| w. ndt( ) . set ( u16 :: try_from( len) . unwrap( ) ) ) ;
162162 }
163163
164164 /// Starts the DMA transfer
165165 pub fn start( & mut self ) {
166- self . ch( ) . cr. modify( |_, w| w. en( ) . set_bit( ) ) ;
166+ self . ch( ) . cr( ) . modify( |_, w| w. en( ) . set_bit( ) ) ;
167167 }
168168
169169 /// Stops the DMA transfer
170170 pub fn stop( & mut self ) {
171171 self . ifcr( ) . write( |w| w. $cgifX( ) . set_bit( ) ) ;
172- self . ch( ) . cr. modify( |_, w| w. en( ) . clear_bit( ) ) ;
172+ self . ch( ) . cr( ) . modify( |_, w| w. en( ) . clear_bit( ) ) ;
173173 }
174174
175175 /// Returns `true` if there's a transfer in progress
@@ -181,40 +181,40 @@ macro_rules! dma {
181181 impl $CX {
182182 pub fn listen( & mut self , event: Event ) {
183183 match event {
184- Event :: HalfTransfer => self . ch( ) . cr. modify( |_, w| w. htie( ) . set_bit( ) ) ,
184+ Event :: HalfTransfer => self . ch( ) . cr( ) . modify( |_, w| w. htie( ) . set_bit( ) ) ,
185185 Event :: TransferComplete => {
186- self . ch( ) . cr. modify( |_, w| w. tcie( ) . set_bit( ) )
186+ self . ch( ) . cr( ) . modify( |_, w| w. tcie( ) . set_bit( ) )
187187 }
188188 }
189189 }
190190
191191 pub fn unlisten( & mut self , event: Event ) {
192192 match event {
193193 Event :: HalfTransfer => {
194- self . ch( ) . cr. modify( |_, w| w. htie( ) . clear_bit( ) )
194+ self . ch( ) . cr( ) . modify( |_, w| w. htie( ) . clear_bit( ) )
195195 } ,
196196 Event :: TransferComplete => {
197- self . ch( ) . cr. modify( |_, w| w. tcie( ) . clear_bit( ) )
197+ self . ch( ) . cr( ) . modify( |_, w| w. tcie( ) . clear_bit( ) )
198198 }
199199 }
200200 }
201201
202202 pub fn ch( & mut self ) -> & dma1:: CH {
203- unsafe { & ( * $DMAX:: ptr( ) ) . $chX }
203+ unsafe { ( * $DMAX:: ptr( ) ) . $chX( ) }
204204 }
205205
206206 pub fn isr( & self ) -> dma1:: isr:: R {
207207 // NOTE(unsafe) atomic read with no side effects
208- unsafe { ( * $DMAX:: ptr( ) ) . isr. read( ) }
208+ unsafe { ( * $DMAX:: ptr( ) ) . isr( ) . read( ) }
209209 }
210210
211211 pub fn ifcr( & self ) -> & dma1:: IFCR {
212- unsafe { & ( * $DMAX:: ptr( ) ) . ifcr }
212+ unsafe { & ( * $DMAX:: ptr( ) ) . ifcr( ) }
213213 }
214214
215215 pub fn get_ndtr( & self ) -> u32 {
216216 // NOTE(unsafe) atomic read with no side effects
217- unsafe { & ( * $DMAX:: ptr( ) ) } . $chX. ndtr. read( ) . bits( )
217+ unsafe { & ( * $DMAX:: ptr( ) ) } . $chX( ) . ndtr( ) . read( ) . bits( )
218218 }
219219 }
220220
@@ -453,7 +453,7 @@ macro_rules! dma {
453453
454454 // reset the DMA control registers (stops all on-going transfers)
455455 $(
456- self . $chX. cr. reset( ) ;
456+ self . $chX( ) . cr( ) . reset( ) ;
457457 ) +
458458
459459 Channels ( ( ) , $( $CX { _0: ( ) } ) ,+)
0 commit comments