Skip to content

Commit 1c8b813

Browse files
authored
Fix confusion between pin number and AF number (#254)
Co-authored-by: Tobias Naumann <tobias.naumann@iml.fraunhofer.de>
1 parent 0e34084 commit 1c8b813

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/gpio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ macro_rules! impl_into_af {
149149
// push pull output
150150
otyper
151151
.otyper()
152-
.modify(|r, w| unsafe { w.bits(r.bits() & !(0b1 << $NUM)) });
152+
.modify(|r, w| unsafe { w.bits(r.bits() & !(0b1 << $i)) });
153153
afr.afr().modify(|r, w| unsafe {
154154
w.bits((r.bits() & !(0b1111 << OFF_AFR)) | ($NUM << OFF_AFR))
155155
});
@@ -170,7 +170,7 @@ macro_rules! impl_into_af {
170170
// open drain output
171171
otyper
172172
.otyper()
173-
.modify(|r, w| unsafe { w.bits(r.bits() | (0b1 << $NUM)) });
173+
.modify(|r, w| unsafe { w.bits(r.bits() | (0b1 << $i)) });
174174
afr.afr().modify(|r, w| unsafe {
175175
w.bits((r.bits() & !(0b1111 << OFF_AFR)) | ($NUM << OFF_AFR))
176176
});

0 commit comments

Comments
 (0)