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/avr/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/avr/gpio.c')
-rw-r--r-- | src/avr/gpio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/avr/gpio.c b/src/avr/gpio.c index c7ca1220..6ff21c26 100644 --- a/src/avr/gpio.c +++ b/src/avr/gpio.c @@ -74,7 +74,7 @@ gpio_out_write(struct gpio_out g, uint8_t val) struct gpio_in gpio_in_setup(uint8_t pin, int8_t pull_up) { - if (GPIO2PORT(pin) >= ARRAY_SIZE(digital_regs)) + if (GPIO2PORT(pin) >= ARRAY_SIZE(digital_regs) || pull_up < 0) goto fail; struct gpio_digital_regs *regs = GPIO2REGS(pin); if (! regs) @@ -83,7 +83,7 @@ gpio_in_setup(uint8_t pin, int8_t pull_up) gpio_in_reset(g, pull_up); return g; fail: - shutdown("Not an input pin"); + shutdown("Not a valid input pin"); } void |