From dddfb681c737c5623dc270bf6c8e59fd3b13b092 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 27 Feb 2019 11:07:51 -0500 Subject: pins: Add support for pull down resistors Add initial support for selecting pull down resistors (for micro-controllers that support it). Signed-off-by: Kevin O'Connor --- src/stm32f1/gpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/stm32f1/gpio.c') diff --git a/src/stm32f1/gpio.c b/src/stm32f1/gpio.c index e6df3888..ed950461 100644 --- a/src/stm32f1/gpio.c +++ b/src/stm32f1/gpio.c @@ -114,7 +114,8 @@ gpio_in_reset(struct gpio_in g, int8_t pull_up) irqstatus_t flag = irq_save(); if (pull_up) { LL_GPIO_SetPinMode(g.regs, g.bit, LL_GPIO_MODE_INPUT); - LL_GPIO_SetPinPull(g.regs, g.bit, LL_GPIO_PULL_UP); + uint32_t p = pull_up > 0 ? LL_GPIO_PULL_UP : LL_GPIO_PULL_DOWN; + LL_GPIO_SetPinPull(g.regs, g.bit, p); } else { LL_GPIO_SetPinMode(g.regs, g.bit, LL_GPIO_MODE_FLOATING); } -- cgit v1.2.3-70-g09d2