summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/stm32/gpio-stm32f.c5
-rw-r--r--chip/stm32/gpio-stm32f0.c4
-rw-r--r--chip/stm32/gpio-stm32l.c4
3 files changed, 12 insertions, 1 deletions
diff --git a/chip/stm32/gpio-stm32f.c b/chip/stm32/gpio-stm32f.c
index 9e6c6799b6..e9f7944354 100644
--- a/chip/stm32/gpio-stm32f.c
+++ b/chip/stm32/gpio-stm32f.c
@@ -81,7 +81,10 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t pmask, uint32_t flags)
* GPIOx_ODR determines which resistor to activate in
* input mode, see Table 16 (datasheet rm0041)
*/
- if (flags & GPIO_PULL_UP) {
+ if (flags & GPIO_ANALOG) {
+ /* Analog input, MODE=00 CNF=00 */
+ /* the 4 bits in mask are already reset above */
+ } else if (flags & GPIO_PULL_UP) {
mask |= 0x88888888 & cnf;
STM32_GPIO_BSRR(port) = pmask;
} else if (flags & GPIO_PULL_DOWN) {
diff --git a/chip/stm32/gpio-stm32f0.c b/chip/stm32/gpio-stm32f0.c
index 6933697c46..8e756ab183 100644
--- a/chip/stm32/gpio-stm32f0.c
+++ b/chip/stm32/gpio-stm32f0.c
@@ -67,6 +67,10 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags)
val |= 0x55555555 & mask2;
STM32_GPIO_MODER(port) = val;
+ } else if (flags & GPIO_ANALOG) {
+ /* Analog, MODE=11 */
+ val |= 0xFFFFFFFF & mask2;
+ STM32_GPIO_MODER(port) = val;
} else if (flags & GPIO_INPUT) {
/* Input, MODE=00 */
STM32_GPIO_MODER(port) = val;
diff --git a/chip/stm32/gpio-stm32l.c b/chip/stm32/gpio-stm32l.c
index 7283526d89..ca627dd701 100644
--- a/chip/stm32/gpio-stm32l.c
+++ b/chip/stm32/gpio-stm32l.c
@@ -67,6 +67,10 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags)
val |= 0x55555555 & mask2;
STM32_GPIO_MODER(port) = val;
+ } else if (flags & GPIO_ANALOG) {
+ /* Analog, MODE=11 */
+ val |= 0xFFFFFFFF & mask2;
+ STM32_GPIO_MODER(port) = val;
} else if (flags & GPIO_INPUT) {
/* Input, MODE=00 */
STM32_GPIO_MODER(port) = val;