diff options
| author | Dan Halbert <halbert@halwitz.org> | 2021-01-25 17:23:57 -0500 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2021-01-25 22:16:24 -0500 |
| commit | be4cfdd3d6d08796757a4582061e819e3f903ce4 (patch) | |
| tree | 765b5030853e8a71c40df5c312588b3f4c34f9bb /ports | |
| parent | 0fa5aa359df3827a90be6c4e82719bb2ed8713e7 (diff) | |
Use TOTAL_GPIO_COUNT instead of magic number 30
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/raspberrypi/common-hal/microcontroller/Pin.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.c b/ports/raspberrypi/common-hal/microcontroller/Pin.c index 6e531560e..ca5cf5a04 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Pin.c +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.c @@ -26,6 +26,7 @@ #include "py/runtime.h" +#include "common-hal/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/rgb_led_status.h" @@ -46,7 +47,7 @@ bool speaker_enable_in_use; STATIC uint32_t never_reset_pins; void reset_all_pins(void) { - for (size_t i = 0; i < 30; i++) { + for (size_t i = 0; i < TOTAL_GPIO_COUNT; i++) { if ((never_reset_pins & (1 << i)) != 0) { continue; } @@ -55,7 +56,7 @@ void reset_all_pins(void) { } void never_reset_pin_number(uint8_t pin_number) { - if (pin_number >= 32) { + if (pin_number >= TOTAL_GPIO_COUNT) { return; } @@ -63,7 +64,7 @@ void never_reset_pin_number(uint8_t pin_number) { } void reset_pin_number(uint8_t pin_number) { - if (pin_number >= 32) { + if (pin_number >= TOTAL_GPIO_COUNT) { return; } @@ -134,7 +135,7 @@ void claim_pin(const mcu_pin_obj_t* pin) { } bool pin_number_is_free(uint8_t pin_number) { - if (pin_number >= 30) { + if (pin_number >= TOTAL_GPIO_COUNT) { return false; } |
