diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-02-27 11:07:51 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-02-27 11:13:21 -0500 |
commit | dddfb681c737c5623dc270bf6c8e59fd3b13b092 (patch) | |
tree | c295b1c5837c2f1d6f6f569b595b2506cd2f69b7 /src/stm32f1/gpio.c | |
parent | b6589406d46186bc9ae76a3db49363c5168e30e9 (diff) | |
download | kutter-dddfb681c737c5623dc270bf6c8e59fd3b13b092.tar.gz kutter-dddfb681c737c5623dc270bf6c8e59fd3b13b092.tar.xz kutter-dddfb681c737c5623dc270bf6c8e59fd3b13b092.zip |
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 <kevin@koconnor.net>
Diffstat (limited to 'src/stm32f1/gpio.c')
-rw-r--r-- | src/stm32f1/gpio.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); } |