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>
This commit is contained in:
Kevin O'Connor
2019-02-27 11:07:51 -05:00
parent b6589406d4
commit dddfb681c7
6 changed files with 40 additions and 20 deletions

View File

@@ -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);
}