diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2022-11-17 14:38:41 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2022-11-19 10:13:50 -0500 |
commit | b9a378c1ca630ba72d19640e7dee2ec4aec971ea (patch) | |
tree | 44d4c7afee24a05d625161530e5565c4a8e0f0c7 /src/rp2040 | |
parent | d17ef95a3c940b674bbda91573066f20200c902d (diff) | |
download | kutter-b9a378c1ca630ba72d19640e7dee2ec4aec971ea.tar.gz kutter-b9a378c1ca630ba72d19640e7dee2ec4aec971ea.tar.xz kutter-b9a378c1ca630ba72d19640e7dee2ec4aec971ea.zip |
rp2040: Fix boundary check for max gpio pin
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/rp2040')
-rw-r--r-- | src/rp2040/gpio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rp2040/gpio.c b/src/rp2040/gpio.c index bac67d23..98e07789 100644 --- a/src/rp2040/gpio.c +++ b/src/rp2040/gpio.c @@ -48,7 +48,7 @@ mask_to_pin(uint32_t mask) struct gpio_out gpio_out_setup(uint8_t pin, uint8_t val) { - if (pin > 30) + if (pin >= 30) goto fail; struct gpio_out g = { .bit=1<<pin }; gpio_out_reset(g, val); @@ -93,7 +93,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 (pin > 30) + if (pin >= 30) goto fail; struct gpio_in g = { .bit=1<<pin }; gpio_in_reset(g, pull_up); |