diff options
| author | Dan Halbert <halbert@halwitz.org> | 2017-11-07 10:19:08 -0500 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2017-11-07 10:08:34 -0800 |
| commit | 9060df5af6fe3bf68eae6cdb57db74565c1370bd (patch) | |
| tree | 3d9a405002ce57e653388774ba8d76261cadf6d6 | |
| parent | 7292984204e7ac28a5b69c23930ff7b8be003faf (diff) | |
DigitalInOut: Use pin value % 32 to accomodate PORTB and up.
Fixes #407.
| -rw-r--r-- | ports/atmel-samd/common-hal/digitalio/DigitalInOut.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c index 6fd1dc32d..c5fff4ba2 100644 --- a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c +++ b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c @@ -105,10 +105,10 @@ bool common_hal_digitalio_digitalinout_get_value( if (!self->output) { return gpio_get_pin_level(pin); } else { - if (self->open_drain && hri_port_get_DIR_reg(PORT, (enum gpio_port)GPIO_PORT(pin), 1U << pin) == 0) { + if (self->open_drain && hri_port_get_DIR_reg(PORT, (enum gpio_port)GPIO_PORT(pin), 1U << GPIO_PIN(pin)) == 0) { return true; } else { - return hri_port_get_OUT_reg(PORT, (enum gpio_port)GPIO_PORT(pin), 1U << pin); + return hri_port_get_OUT_reg(PORT, (enum gpio_port)GPIO_PORT(pin), 1U << GPIO_PIN(pin)); } } } @@ -160,7 +160,7 @@ enum digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( } else { if (hri_port_get_PINCFG_PULLEN_bit(PORT, (enum gpio_port)GPIO_PORT(pin), pin) == 0) { return PULL_NONE; - } if (hri_port_get_OUT_reg(PORT, (enum gpio_port)GPIO_PORT(pin), 1U << pin) > 0) { + } if (hri_port_get_OUT_reg(PORT, (enum gpio_port)GPIO_PORT(pin), 1U << GPIO_PIN(pin)) > 0) { return PULL_UP; } else { return PULL_DOWN; |
