Skip to content

Commit 5fadb26

Browse files
committed
Fixed broken InterruptIn.mode() in NRF5x target which didn't do anything: interruptIn always remained with pullup resistor enabled.
1 parent 799ba08 commit 5fadb26

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/gpio_api.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,18 @@ static void gpio_apply_config(uint8_t pin)
129129
cfg.hi_accuracy = false;
130130
cfg.is_watcher = false;
131131
cfg.sense = NRF_GPIOTE_POLARITY_TOGGLE;
132+
switch(m_gpio_cfg[pin].pull) {
133+
case PullUp:
134+
cfg.pull = NRF_GPIO_PIN_PULLUP;
135+
break;
136+
case PullDown:
137+
cfg.pull = NRF_GPIO_PIN_PULLDOWN;
138+
break;
139+
default:
140+
cfg.pull = NRF_GPIO_PIN_NOPULL;
141+
break;
142+
}
132143
if (m_gpio_cfg[pin].used_as_irq) {
133-
cfg.pull = NRF_GPIO_PIN_PULLUP;
134144
nrf_drv_gpiote_in_init(pin, &cfg, gpiote_irq_handler);
135145
if ((m_gpio_irq_enabled & ((gpio_mask_t)1 << pin))
136146
&& (m_gpio_cfg[pin].irq_rise || m_gpio_cfg[pin].irq_fall))
@@ -139,17 +149,6 @@ static void gpio_apply_config(uint8_t pin)
139149
}
140150
}
141151
else {
142-
switch(m_gpio_cfg[pin].pull) {
143-
case PullUp:
144-
cfg.pull = NRF_GPIO_PIN_PULLUP;
145-
break;
146-
case PullDown:
147-
cfg.pull = NRF_GPIO_PIN_PULLDOWN;
148-
break;
149-
default:
150-
cfg.pull = NRF_GPIO_PIN_NOPULL;
151-
break;
152-
}
153152
nrf_gpio_cfg_input(pin,cfg.pull);
154153
}
155154
}

0 commit comments

Comments
 (0)