Fixed broken InterruptIn.mode() in NRF5x target which didn't do anything: interruptIn always remained with pullup resistor enabled.

pull/7375/head
Melvin van den berg 2018-06-14 16:54:03 +02:00 committed by adbridge
parent 4a5e6a9d7d
commit f59655629e
1 changed files with 11 additions and 12 deletions

View File

@ -129,16 +129,6 @@ static void gpio_apply_config(uint8_t pin)
cfg.hi_accuracy = false;
cfg.is_watcher = false;
cfg.sense = NRF_GPIOTE_POLARITY_TOGGLE;
if (m_gpio_cfg[pin].used_as_irq) {
cfg.pull = NRF_GPIO_PIN_PULLUP;
nrf_drv_gpiote_in_init(pin, &cfg, gpiote_irq_handler);
if ((m_gpio_irq_enabled & ((gpio_mask_t)1 << pin))
&& (m_gpio_cfg[pin].irq_rise || m_gpio_cfg[pin].irq_fall))
{
nrf_drv_gpiote_in_event_enable(pin, true);
}
}
else {
switch(m_gpio_cfg[pin].pull) {
case PullUp:
cfg.pull = NRF_GPIO_PIN_PULLUP;
@ -150,6 +140,15 @@ static void gpio_apply_config(uint8_t pin)
cfg.pull = NRF_GPIO_PIN_NOPULL;
break;
}
if (m_gpio_cfg[pin].used_as_irq) {
nrf_drv_gpiote_in_init(pin, &cfg, gpiote_irq_handler);
if ((m_gpio_irq_enabled & ((gpio_mask_t)1 << pin))
&& (m_gpio_cfg[pin].irq_rise || m_gpio_cfg[pin].irq_fall))
{
nrf_drv_gpiote_in_event_enable(pin, true);
}
}
else {
nrf_gpio_cfg_input(pin,cfg.pull);
}
}