2
2
3
3
//! GPIO pins
4
4
5
- use ast1060_pac:: { Gpio , Scu } ;
5
+ use ast1060_pac:: Gpio ;
6
6
use core:: marker:: PhantomData ;
7
7
use embedded_hal:: digital:: { InputPin , OutputPin , StatefulOutputPin } ;
8
8
@@ -197,91 +197,9 @@ macro_rules! gpio_macro {
197
197
}
198
198
199
199
impl <MODE > $PXi<MODE > {
200
- pub fn set_up_multifunc_pin_ctrl( self ) {
201
- let p = unsafe { & * Scu :: ptr( ) } ;
202
- match $x {
203
- 'a' | 'b' | 'c' | 'd' => {
204
- p. scu410( ) . modify( |r, w| unsafe {
205
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
206
- } ) ;
207
- p. scu4b0( ) . modify( |r, w| unsafe {
208
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
209
- } ) ;
210
- p. scu690( ) . modify( |r, w| unsafe {
211
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
212
- } ) ;
213
- } ,
214
- 'e' | 'f' | 'g' | 'h' => {
215
- p. scu414( ) . modify( |r, w| unsafe {
216
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
217
- } ) ;
218
- if $x != 'h' || $i < 6 {
219
- p. scu4b4( ) . modify( |r, w| unsafe {
220
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
221
- } ) ;
222
- p. scu694( ) . modify( |r, w| unsafe {
223
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
224
- } ) ;
225
- }
226
- } ,
227
- 'i' | 'j' | 'k' | 'l' => {
228
- p. scu418( ) . modify( |r, w| unsafe {
229
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
230
- } ) ;
231
- if $x == 'j' || $x == 'k' || ( $x == 'l' && $i > 3 ) {
232
- p. scu4b8( ) . modify( |r, w| unsafe {
233
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
234
- } ) ;
235
- }
236
- if $x == 'l' && $i > 3 {
237
- p. scu698( ) . modify( |r, w| unsafe {
238
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
239
- } ) ;
240
- }
241
- } ,
242
- 'm' | 'n' | 'o' | 'p' => {
243
- p. scu41c( ) . modify( |r, w| unsafe {
244
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
245
- } ) ;
246
- if ( $x == 'n' && $i != 2 ) || $x == 'o' || $x == 'p' {
247
- p. scu4bc( ) . modify( |r, w| unsafe {
248
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
249
- } ) ;
250
- }
251
- if ( $x == 'o' && $i > 3 ) || ( $x == 'p' && ( $i == 0 || $i > 5 ) ) {
252
- p. scu69c( ) . modify( |r, w| unsafe {
253
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
254
- } ) ;
255
- }
256
- } ,
257
- 'q' | 'r' | 's' => {
258
- p. scu430( ) . modify( |r, w| unsafe {
259
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
260
- } ) ;
261
- if $x == 'q' && $i < 5 {
262
- p. scu6b0( ) . modify( |r, w| unsafe {
263
- w. bits( r. bits( ) & !( 1u32 << ( $pos + $i) ) )
264
- } ) ;
265
- }
266
- } ,
267
- 't' => {
268
- p. scu430( ) . modify( |r, w| unsafe {
269
- w. bits( r. bits( ) | ( 1u32 << ( $pos + $i) ) )
270
- } ) ;
271
- } ,
272
- 'u' => {
273
- p. scu434( ) . modify( |r, w| unsafe {
274
- w. bits( r. bits( ) | ( 1u32 << ( $pos + $i) ) )
275
- } ) ;
276
- } ,
277
- _ => { } ,
278
- }
279
- }
280
-
281
200
/// Configures the pin to operate as a pulled down input pin
282
201
#[ must_use]
283
202
pub fn into_pull_down_input( self ) -> $PXi<Input <PullDown >> {
284
- self . set_up_multifunc_pin_ctrl( ) ;
285
203
let p = unsafe { & * Gpio :: ptr( ) } ;
286
204
//dir
287
205
p. $dir_reg( ) . modify( |r, w| unsafe {
@@ -297,7 +215,6 @@ macro_rules! gpio_macro {
297
215
/// Configures the pin to operate as a pulled up input pin
298
216
#[ must_use]
299
217
pub fn into_pull_up_input( self ) -> $PXi<Input <PullUp >> {
300
- self . set_up_multifunc_pin_ctrl( ) ;
301
218
let p = unsafe { & * Gpio :: ptr( ) } ;
302
219
//dir
303
220
p. $dir_reg( ) . modify( |r, w| unsafe {
@@ -313,7 +230,6 @@ macro_rules! gpio_macro {
313
230
/// Configures the pin to operate as an open drain output pin
314
231
#[ must_use]
315
232
pub fn into_open_drain_output<ODM >( self ) -> $PXi<Output <OpenDrain <ODM >>> where ODM : OpenDrainMode {
316
- self . set_up_multifunc_pin_ctrl( ) ;
317
233
let p = unsafe { & * Gpio :: ptr( ) } ;
318
234
//data
319
235
// 0 for active low; 1 for active high??
@@ -330,7 +246,6 @@ macro_rules! gpio_macro {
330
246
/// Configures the pin to operate as an push pull output pin
331
247
#[ must_use]
332
248
pub fn into_push_pull_output( self ) -> $PXi<Output <PushPull >> {
333
- self . set_up_multifunc_pin_ctrl( ) ;
334
249
let p = unsafe { & * Gpio :: ptr( ) } ;
335
250
//dir
336
251
p. $dir_reg( ) . modify( |r, w| unsafe {
0 commit comments