set moder::ALTERNATE last when configuring pins to AF modes.

- as per STM32F4xx_hal's impl
This commit is contained in:
Joshua Salzedo 2021-09-27 15:27:43 -07:00
parent 6aa675994d
commit 67e2f9159c
No known key found for this signature in database
GPG Key ID: C3D0EB484493B731

View File

@ -310,9 +310,6 @@ pub(crate) mod sealed {
unsafe fn set_as_af(&self, af_num: u8, af_type: OutputType) {
let pin = self._pin() as usize;
let block = self.block();
block
.moder()
.modify(|w| w.set_moder(pin, vals::Moder::ALTERNATE));
block
.afr(pin / 8)
.modify(|w| w.set_afr(pin % 8, vals::Afr(af_num)));
@ -327,6 +324,10 @@ pub(crate) mod sealed {
block
.pupdr()
.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) {