summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-07-09 17:18:06 -0400
committerDan Halbert <halbert@halwitz.org>2018-07-09 17:18:06 -0400
commit8bb363f7c4f537e90659bc98e1a1cd0097424d96 (patch)
tree1c4fdcdbc95eefa863c0618d29644bf389a0c7e7
parentfba2d9fa6c1f8bf75694f210ce70a18c4e06d85f (diff)
must set pull after setting direction with gpio_set_pin routines
-rw-r--r--ports/atmel-samd/common-hal/digitalio/DigitalInOut.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
index 03bd225b1..c5c8f48e9 100644
--- a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
+++ b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
@@ -40,8 +40,9 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct(
claim_pin(pin);
self->pin = pin;
- gpio_set_pin_pull_mode(pin->pin, GPIO_PULL_OFF);
+ // Must set pull after setting direction.
gpio_set_pin_direction(pin->pin, GPIO_DIRECTION_IN);
+ gpio_set_pin_pull_mode(pin->pin, GPIO_PULL_OFF);
return DIGITALINOUT_OK;
}
@@ -154,9 +155,9 @@ void common_hal_digitalio_digitalinout_set_pull(
default:
break;
}
- // Set pull first to avoid glitches.
- gpio_set_pin_pull_mode(self->pin->pin, asf_pull);
+ // Must set pull after setting direction.
gpio_set_pin_direction(self->pin->pin, GPIO_DIRECTION_IN);
+ gpio_set_pin_pull_mode(self->pin->pin, asf_pull);
}
digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(