@@ -59,17 +59,11 @@ mod tests {
59
59
60
60
pin. set_high ( ) ;
61
61
delay. delay ( 1 . millis ( ) ) ; // Give the pin plenty of time to go high
62
- {
63
- let gpioa = unsafe { & * GPIOA :: PTR } ;
64
- assert ! ( !is_pax_low( gpioa, pin_num) ) ;
65
- }
62
+ assert ! ( !is_pax_low( pin_num) ) ;
66
63
67
64
pin. set_low ( ) ;
68
65
delay. delay ( 1 . millis ( ) ) ; // Give the pin plenty of time to go low
69
- {
70
- let gpioa = unsafe { & * GPIOA :: PTR } ;
71
- assert ! ( is_pax_low( gpioa, pin_num) ) ;
72
- }
66
+ assert ! ( is_pax_low( pin_num) ) ;
73
67
}
74
68
75
69
#[ test]
@@ -96,18 +90,12 @@ mod tests {
96
90
pin. set_high ( ) ;
97
91
delay. delay ( 1 . millis ( ) ) ; // Give the pin plenty of time to go high
98
92
assert ! ( pin. is_high( ) ) ;
99
- {
100
- let gpioa = unsafe { & * GPIOA :: PTR } ;
101
- assert ! ( !is_pax_low( gpioa, pin_num) ) ;
102
- }
93
+ assert ! ( !is_pax_low( pin_num) ) ;
103
94
104
95
pin. set_low ( ) ;
105
96
delay. delay ( 1 . millis ( ) ) ; // Give the pin plenty of time to go low
106
97
assert ! ( pin. is_low( ) ) ;
107
- {
108
- let gpioa = unsafe { & * GPIOA :: PTR } ;
109
- assert ! ( is_pax_low( gpioa, pin_num) ) ;
110
- }
98
+ assert ! ( is_pax_low( pin_num) ) ;
111
99
}
112
100
113
101
#[ test]
@@ -132,21 +120,19 @@ mod tests {
132
120
pwm. set_duty_cycle_percent ( 50 ) . unwrap ( ) ;
133
121
pwm. enable ( ) ;
134
122
135
- let gpioa = unsafe { & * GPIOA :: PTR } ;
136
-
137
123
let min: MicrosDurationU32 = 495u32 . micros ( ) ;
138
124
let max: MicrosDurationU32 = 505u32 . micros ( ) ;
139
125
140
126
debug ! ( "Awaiting first rising edge..." ) ;
141
- let duration_until_lo = await_lo ( & timer, gpioa , pin_num, max) . unwrap ( ) ;
142
- let first_lo_duration = await_hi ( & timer, gpioa , pin_num, max) . unwrap ( ) ;
127
+ let duration_until_lo = await_lo ( & timer, pin_num, max) . unwrap ( ) ;
128
+ let first_lo_duration = await_hi ( & timer, pin_num, max) . unwrap ( ) ;
143
129
144
130
let mut hi_duration = 0 . micros ( ) ;
145
131
let mut lo_duration = 0 . micros ( ) ;
146
132
147
133
for _ in 0 ..10 {
148
134
// Make sure the timer half periods are within 495-505us
149
- hi_duration = await_lo ( & timer, gpioa , pin_num, max) . unwrap ( ) ;
135
+ hi_duration = await_lo ( & timer, pin_num, max) . unwrap ( ) ;
150
136
assert ! (
151
137
hi_duration > min && hi_duration < max,
152
138
"hi: {} < {} < {}" ,
@@ -155,7 +141,7 @@ mod tests {
155
141
max
156
142
) ;
157
143
158
- lo_duration = await_hi ( & timer, gpioa , pin_num, max) . unwrap ( ) ;
144
+ lo_duration = await_hi ( & timer, pin_num, max) . unwrap ( ) ;
159
145
assert ! (
160
146
lo_duration > min && lo_duration < max,
161
147
"lo: {} < {} < {}" ,
0 commit comments