Correctly set alternate function for stm32f1 gpios

This commit is contained in:
Tobias Pisani 2021-10-09 22:03:22 +02:00
parent 091e7e1f98
commit c44bed300b

View file

@ -407,11 +407,17 @@ pub(crate) mod sealed {
match af_type {
// TODO: Do we need to configure input AF pins differently?
AFType::OutputPushPull => {
r.cr(crlh).modify(|w| w.set_cnf(n % 8, vals::Cnf::PUSHPULL));
r.cr(crlh).modify(|w| {
w.set_mode(n % 8, vals::Mode::OUTPUT50);
w.set_cnf(n % 8, vals::Cnf::ALTPUSHPULL);
});
}
AFType::OutputOpenDrain => {
r.cr(crlh).modify(|w| {
w.set_mode(n % 8, vals::Mode::OUTPUT50);
w.set_cnf(n % 8, vals::Cnf::ALTOPENDRAIN);
});
}
AFType::OutputOpenDrain => r
.cr(crlh)
.modify(|w| w.set_cnf(n % 8, vals::Cnf::OPENDRAIN)),
}
}
#[cfg(gpio_v2)]