Merge pull request #407 from theunkn0wn1/fix/into_af
Fix: erroneous behavior of pins being configured into AF
This commit is contained in:
commit
1650983e46
@ -130,9 +130,9 @@ impl<'d, T: Pin> Output<'d, T> {
|
|||||||
let r = pin.block();
|
let r = pin.block();
|
||||||
let n = pin.pin() as usize;
|
let n = pin.pin() as usize;
|
||||||
r.pupdr().modify(|w| w.set_pupdr(n, vals::Pupdr::FLOATING));
|
r.pupdr().modify(|w| w.set_pupdr(n, vals::Pupdr::FLOATING));
|
||||||
r.moder().modify(|w| w.set_moder(n, vals::Moder::OUTPUT));
|
|
||||||
r.otyper().modify(|w| w.set_ot(n, vals::Ot::PUSHPULL));
|
r.otyper().modify(|w| w.set_ot(n, vals::Ot::PUSHPULL));
|
||||||
pin.set_speed(speed);
|
pin.set_speed(speed);
|
||||||
|
r.moder().modify(|w| w.set_moder(n, vals::Moder::OUTPUT));
|
||||||
});
|
});
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
@ -208,9 +208,9 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> {
|
|||||||
let r = pin.block();
|
let r = pin.block();
|
||||||
let n = pin.pin() as usize;
|
let n = pin.pin() as usize;
|
||||||
r.pupdr().modify(|w| w.set_pupdr(n, pull.into()));
|
r.pupdr().modify(|w| w.set_pupdr(n, pull.into()));
|
||||||
r.moder().modify(|w| w.set_moder(n, vals::Moder::OUTPUT));
|
|
||||||
r.otyper().modify(|w| w.set_ot(n, vals::Ot::OPENDRAIN));
|
r.otyper().modify(|w| w.set_ot(n, vals::Ot::OPENDRAIN));
|
||||||
pin.set_speed(speed);
|
pin.set_speed(speed);
|
||||||
|
r.moder().modify(|w| w.set_moder(n, vals::Moder::OUTPUT));
|
||||||
});
|
});
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
@ -310,9 +310,6 @@ pub(crate) mod sealed {
|
|||||||
unsafe fn set_as_af(&self, af_num: u8, af_type: OutputType) {
|
unsafe fn set_as_af(&self, af_num: u8, af_type: OutputType) {
|
||||||
let pin = self._pin() as usize;
|
let pin = self._pin() as usize;
|
||||||
let block = self.block();
|
let block = self.block();
|
||||||
block
|
|
||||||
.moder()
|
|
||||||
.modify(|w| w.set_moder(pin, vals::Moder::ALTERNATE));
|
|
||||||
block
|
block
|
||||||
.afr(pin / 8)
|
.afr(pin / 8)
|
||||||
.modify(|w| w.set_afr(pin % 8, vals::Afr(af_num)));
|
.modify(|w| w.set_afr(pin % 8, vals::Afr(af_num)));
|
||||||
@ -327,6 +324,10 @@ pub(crate) mod sealed {
|
|||||||
block
|
block
|
||||||
.pupdr()
|
.pupdr()
|
||||||
.modify(|w| w.set_pupdr(pin, vals::Pupdr::FLOATING));
|
.modify(|w| w.set_pupdr(pin, vals::Pupdr::FLOATING));
|
||||||
|
|
||||||
|
block
|
||||||
|
.moder()
|
||||||
|
.modify(|w| w.set_moder(pin, vals::Moder::ALTERNATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn set_as_analog(&self) {
|
unsafe fn set_as_analog(&self) {
|
||||||
|
Loading…
Reference in New Issue
Block a user