aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Pisani <[email protected]>2021-10-09 22:03:22 +0200
committerTobias Pisani <[email protected]>2021-10-11 22:57:21 +0200
commitc44bed300b17ef0cb0004758fd085b150533252f (patch)
tree98fdd69a744a3e209b2e42e9d20913e3e311d8f1
parent091e7e1f98c4220889b6fbf4f388320e21f43494 (diff)
Correctly set alternate function for stm32f1 gpios
-rw-r--r--embassy-stm32/src/gpio.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs
index 5c48b5be1..7c331fbb4 100644
--- a/embassy-stm32/src/gpio.rs
+++ b/embassy-stm32/src/gpio.rs
@@ -407,11 +407,17 @@ pub(crate) mod sealed {
407 match af_type { 407 match af_type {
408 // TODO: Do we need to configure input AF pins differently? 408 // TODO: Do we need to configure input AF pins differently?
409 AFType::OutputPushPull => { 409 AFType::OutputPushPull => {
410 r.cr(crlh).modify(|w| w.set_cnf(n % 8, vals::Cnf::PUSHPULL)); 410 r.cr(crlh).modify(|w| {
411 w.set_mode(n % 8, vals::Mode::OUTPUT50);
412 w.set_cnf(n % 8, vals::Cnf::ALTPUSHPULL);
413 });
414 }
415 AFType::OutputOpenDrain => {
416 r.cr(crlh).modify(|w| {
417 w.set_mode(n % 8, vals::Mode::OUTPUT50);
418 w.set_cnf(n % 8, vals::Cnf::ALTOPENDRAIN);
419 });
411 } 420 }
412 AFType::OutputOpenDrain => r
413 .cr(crlh)
414 .modify(|w| w.set_cnf(n % 8, vals::Cnf::OPENDRAIN)),
415 } 421 }
416 } 422 }
417 #[cfg(gpio_v2)] 423 #[cfg(gpio_v2)]