Skip to content

Commit 5510854

Browse files
committed
Properly support pullup configuration using pinmux
1 parent 207526e commit 5510854

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/py_gpio.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ SOFTWARE.
3232
#include "constants.h"
3333
#include "common.h"
3434
#include "event_gpio.h"
35+
#include "c_pinmux.h"
3536

3637
static int gpio_warnings = 1;
3738

@@ -111,7 +112,12 @@ static PyObject *py_setup_channel(PyObject *self, PyObject *args, PyObject *kwar
111112
if (direction == OUTPUT) {
112113
gpio_set_value(gpio, initial);
113114
} else {
114-
gpio_set_value(gpio, pud);
115+
if (pud == PUD_DOWN)
116+
set_pin_mode(channel, "gpio_pd");
117+
else if (pud == PUD_UP)
118+
set_pin_mode(channel, "gpio_pu");
119+
else
120+
set_pin_mode(channel, "gpio");
115121
}
116122

117123
gpio_direction[gpio] = direction;

0 commit comments

Comments
 (0)