summaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authorLucian Copeland <hierophect@gmail.com>2020-11-25 12:14:56 -0500
committerLucian Copeland <hierophect@gmail.com>2020-11-25 12:14:56 -0500
commita854da35d33f1bc1673b4de08b2efa9f4823b805 (patch)
treedcc6c21d49bd4a90b5f6a57b03df5cc27d836b70 /ports
parentc9bc87768322c97e3536ec5d9592f97d54277235 (diff)
Fix masking issue causing pin claim problems
Diffstat (limited to 'ports')
-rw-r--r--ports/esp32s2/common-hal/microcontroller/Pin.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c
index 3c2611efe..394a19e69 100644
--- a/ports/esp32s2/common-hal/microcontroller/Pin.c
+++ b/ports/esp32s2/common-hal/microcontroller/Pin.c
@@ -96,7 +96,7 @@ void reset_all_pins(void) {
}
void claim_pin(const mcu_pin_obj_t* pin) {
- in_use[pin->number / 32] |= (1 << pin->number % 32);
+ in_use[pin->number / 32] |= (1 << (pin->number % 32));
#ifdef MICROPY_HW_NEOPIXEL
if (pin == MICROPY_HW_NEOPIXEL) {
neopixel_in_use = true;
@@ -116,7 +116,7 @@ bool pin_number_is_free(gpio_num_t pin_number) {
#endif
uint8_t offset = pin_number / 32;
- uint8_t mask = 1 << pin_number % 32;
+ uint32_t mask = 1 << (pin_number % 32);
return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0;
}