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

Conversation

melvinvdb
Copy link

Fix mbed::InterruptIn.mode() for NRF5x targets

Description

The interruptIn mode() didn't do anything in nrf5x targets, it always remained with a pullup resistor enabled.
We're migrating from MBed OS 3 to MBed OS 5 and found this problematic issue. The pullup or pulldown resistor should be configurable in the InterruptIn class. Currently this is for a unknown reason fixed to pullup resistor always enabled.

Tested locally on the nrf51422_xxac with GCC_ARM toolchain.

Pull request type

[x] Fix
[ ] Refactor
[ ] New Target
[ ] Feature

…ing: interruptIn always remained with pullup resistor enabled.
@0xc0170
Copy link
Contributor

0xc0170 commented Jun 14, 2018

CLA signed, verified 👍 Thanks for the contribution, we will review it soon

@@ -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.

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

@marcuschangarm
Copy link
Contributor

Looks good. I've added a comment about an uninitialized variable.

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

Please review the comments

- Set default pull mode to PullNone in gpio_irq_init
@melvinvdb
Copy link
Author

Thanks for reviewing. I fixed the coding style with the Mbed OS Artistic Style file.

@marcuschangarm
Copy link
Contributor

Looks good!

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 21, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jun 21, 2018

Build : SUCCESS

Build number : 2415
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7220/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Jun 21, 2018

@mbed-ci
Copy link

mbed-ci commented Jun 21, 2018

@cmonr
Copy link
Contributor

cmonr commented Jun 21, 2018

/morph mbed2-build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants