diff options
| author | root <siehputz@gmail.com> | 2020-09-05 11:42:06 -0500 |
|---|---|---|
| committer | root <siehputz@gmail.com> | 2020-09-05 11:42:06 -0500 |
| commit | 2690faec4313bf36d83374ccbfab02f6abbef6dc (patch) | |
| tree | 99708a62e534f9c054fc85aa7f299eb99cb0c2a7 /ports/stm | |
| parent | ed6cc64c4988387e79ac6889e0fd7f4984a5dfc0 (diff) | |
Moved checks for invalid pin to common-hal/microcontroller/Pin.c
Diffstat (limited to 'ports/stm')
| -rw-r--r-- | ports/stm/common-hal/microcontroller/Pin.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 9fbdedead..996513270 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -70,6 +70,10 @@ void reset_all_pins(void) { // Mark pin as free and return it to a quiescent state. void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { + if ( pin_number == NO_PIN ) { + return; + } + if (pin_port == 0x0F) { return; } @@ -88,6 +92,9 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { } void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) { + if ( pin_number == NO_PIN ) { + return; + } never_reset_pins[pin_port] |= 1<<pin_number; // Make sure never reset pins are also always claimed claimed_pins[pin_port] |= 1<<pin_number; |
