aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/stm32/pin_defs_stm32.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/stm32/pin_defs_stm32.c b/ports/stm32/pin_defs_stm32.c
index 0aef5f95f..a3f9d039d 100644
--- a/ports/stm32/pin_defs_stm32.c
+++ b/ports/stm32/pin_defs_stm32.c
@@ -8,9 +8,9 @@
uint32_t pin_get_mode(const pin_obj_t *pin) {
GPIO_TypeDef *gpio = pin->gpio;
uint32_t mode = (gpio->MODER >> (pin->pin * 2)) & 3;
- if (mode != GPIO_MODE_ANALOG) {
+ if (mode == GPIO_MODE_OUTPUT_PP || mode == GPIO_MODE_AF_PP) {
if (gpio->OTYPER & pin->pin_mask) {
- mode |= 1 << 4;
+ mode |= 1 << 4; // Converts from xxx_PP to xxx_OD
}
}
return mode;