@@ -144,32 +144,32 @@ macro_rules! dma {
144
144
///
145
145
/// `inc` indicates whether the address will be incremented after every byte transfer
146
146
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) ) ;
149
149
}
150
150
151
151
/// `address` where from/to data will be read/write
152
152
///
153
153
/// `inc` indicates whether the address will be incremented after every byte transfer
154
154
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) ) ;
157
157
}
158
158
159
159
/// Number of bytes to transfer
160
160
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( ) ) ) ;
162
162
}
163
163
164
164
/// Starts the DMA transfer
165
165
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( ) ) ;
167
167
}
168
168
169
169
/// Stops the DMA transfer
170
170
pub fn stop( & mut self ) {
171
171
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( ) ) ;
173
173
}
174
174
175
175
/// Returns `true` if there's a transfer in progress
@@ -181,40 +181,40 @@ macro_rules! dma {
181
181
impl $CX {
182
182
pub fn listen( & mut self , event: Event ) {
183
183
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( ) ) ,
185
185
Event :: TransferComplete => {
186
- self . ch( ) . cr. modify( |_, w| w. tcie( ) . set_bit( ) )
186
+ self . ch( ) . cr( ) . modify( |_, w| w. tcie( ) . set_bit( ) )
187
187
}
188
188
}
189
189
}
190
190
191
191
pub fn unlisten( & mut self , event: Event ) {
192
192
match event {
193
193
Event :: HalfTransfer => {
194
- self . ch( ) . cr. modify( |_, w| w. htie( ) . clear_bit( ) )
194
+ self . ch( ) . cr( ) . modify( |_, w| w. htie( ) . clear_bit( ) )
195
195
} ,
196
196
Event :: TransferComplete => {
197
- self . ch( ) . cr. modify( |_, w| w. tcie( ) . clear_bit( ) )
197
+ self . ch( ) . cr( ) . modify( |_, w| w. tcie( ) . clear_bit( ) )
198
198
}
199
199
}
200
200
}
201
201
202
202
pub fn ch( & mut self ) -> & dma1:: CH {
203
- unsafe { & ( * $DMAX:: ptr( ) ) . $chX }
203
+ unsafe { ( * $DMAX:: ptr( ) ) . $chX( ) }
204
204
}
205
205
206
206
pub fn isr( & self ) -> dma1:: isr:: R {
207
207
// NOTE(unsafe) atomic read with no side effects
208
- unsafe { ( * $DMAX:: ptr( ) ) . isr. read( ) }
208
+ unsafe { ( * $DMAX:: ptr( ) ) . isr( ) . read( ) }
209
209
}
210
210
211
211
pub fn ifcr( & self ) -> & dma1:: IFCR {
212
- unsafe { & ( * $DMAX:: ptr( ) ) . ifcr }
212
+ unsafe { & ( * $DMAX:: ptr( ) ) . ifcr( ) }
213
213
}
214
214
215
215
pub fn get_ndtr( & self ) -> u32 {
216
216
// NOTE(unsafe) atomic read with no side effects
217
- unsafe { & ( * $DMAX:: ptr( ) ) } . $chX. ndtr. read( ) . bits( )
217
+ unsafe { & ( * $DMAX:: ptr( ) ) } . $chX( ) . ndtr( ) . read( ) . bits( )
218
218
}
219
219
}
220
220
@@ -453,7 +453,7 @@ macro_rules! dma {
453
453
454
454
// reset the DMA control registers (stops all on-going transfers)
455
455
$(
456
- self . $chX. cr. reset( ) ;
456
+ self . $chX( ) . cr( ) . reset( ) ;
457
457
) +
458
458
459
459
Channels ( ( ) , $( $CX { _0: ( ) } ) ,+)
0 commit comments