Skip to content

Fix mbed::InterruptIn.mode() in NRF5x targets #7220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 21, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions targets/TARGET_NORDIC/TARGET_NRF5x/gpio_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,18 @@ static void gpio_apply_config(uint8_t pin)
cfg.hi_accuracy = false;
cfg.is_watcher = false;
cfg.sense = NRF_GPIOTE_POLARITY_TOGGLE;
switch(m_gpio_cfg[pin].pull) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_gpio_cfg[pin].pull should be initialized to NRF_GPIO_PIN_NOPULL in function gpio_irq_init below.

case PullUp:
cfg.pull = NRF_GPIO_PIN_PULLUP;
break;
case PullDown:
cfg.pull = NRF_GPIO_PIN_PULLDOWN;
break;
default:
cfg.pull = NRF_GPIO_PIN_NOPULL;
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xc0170 I'm not up to speed on our style guide. Is this correctly formatted?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed

}
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))
Expand All @@ -139,17 +149,6 @@ static void gpio_apply_config(uint8_t pin)
}
}
else {
switch(m_gpio_cfg[pin].pull) {
case PullUp:
cfg.pull = NRF_GPIO_PIN_PULLUP;
break;
case PullDown:
cfg.pull = NRF_GPIO_PIN_PULLDOWN;
break;
default:
cfg.pull = NRF_GPIO_PIN_NOPULL;
break;
}
nrf_gpio_cfg_input(pin,cfg.pull);
}
}
Expand Down