Skip to content

Interrupt in pin mode #6239

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 7 commits into from
Mar 23, 2018
Merged

Conversation

bmcdonnell-ionx
Copy link
Contributor

@bmcdonnell-ionx bmcdonnell-ionx commented Feb 28, 2018

Description

Currently there's no way to specify the PinMode (PullUp, PullDown, etc.) in the InterruptIn constructor. So I added one, like DigitalIn.

Later: Would it make even more sense to have InterruptIn inherit from DigitalIn?

Pull request type

  • Fix (arguably)
  • Refactor
  • New Target
  • Feature

@cmonr cmonr requested review from geky, pan- and kjbracey February 28, 2018 20:05
@geky geky requested review from c1728p9 and 0xc0170 and removed request for geky February 28, 2018 22:57
pan-
pan- previously approved these changes Mar 1, 2018
Copy link
Member

@pan- pan- left a comment

Choose a reason for hiding this comment

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

Thanks for the submission.

Would it make even more sense to have InterruptIn inherit from DigitalIn?

I think it would make sense, an InterruptIn is a DigitalIn.

@@ -66,6 +66,12 @@ class InterruptIn : private NonCopyable<InterruptIn> {
* @param pin InterruptIn pin to connect to
*/
InterruptIn(PinName pin);
/** Create an InterruptIn connected to the specified pin,
Copy link
Member

Choose a reason for hiding this comment

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

You may want a line break here; same between the constructor and the destructor.

Copy link
Contributor Author

@bmcdonnell-ionx bmcdonnell-ionx Mar 1, 2018

Choose a reason for hiding this comment

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

I tried to match the existing style. Doesn't matter to me which way you prefer it. Let me know, or feel free to change it yourself.

EDIT: Done.

@bmcdonnell-ionx
Copy link
Contributor Author

Is there something I need to do to resolve these CI failures?

@geky
Copy link
Contributor

geky commented Mar 1, 2018

Ah, it looks like the new mode parameter doesn't have documentation.

Could you add a "@param mode Description of mode" line to the doxygen comment?

geky
geky previously approved these changes Mar 1, 2018
Copy link
Contributor

@geky geky left a comment

Choose a reason for hiding this comment

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

Thanks!

@cmonr
Copy link
Contributor

cmonr commented Mar 6, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 6, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Mar 6, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 6, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 8, 2018

/morph mbed2-build

0xc0170
0xc0170 previously approved these changes Mar 8, 2018
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.

LGTM

The same behavior as it is now (gpio_init_in sets it to pull default).

@cmonr
Copy link
Contributor

cmonr commented Mar 21, 2018

Marking as "Ready to Merge" due to lack of review activity.

If anyone else has any additional input, speak now. @SenRamakri @pan- @kjbracey-arm @c1728p9

@kjbracey
Copy link
Contributor

Extension is reasonable from a source point of view, but introduces a binary compatibility break likely to hit the Wi-fi drivers that keep breaking.

Could you retain the original constructor and add a new one, rather than adding a default parameter?

@bmcdonnell-ionx bmcdonnell-ionx dismissed stale reviews from 0xc0170 and geky via e685cb6 March 21, 2018 14:30
@@ -19,16 +19,33 @@

namespace mbed {

// Note: This single-parameter constructor exists to maintain binary
// compatibility for the Wi-Fi drivers.
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be fine in the commit message but I would not keep this in the source here.

It is not just for wifi driver, it was written as an example that the previous change broke binary compability and we should keep it as far as we can, and here we could do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the bit about Wi-Fi drivers, but left the comment. My thinking is I don't want someone to come along later and think they can simplify like I did. A comment in the code should prevent that, whereas a comment just in a commit message is less likely to do so.

If you still want it gone, LMK, or you can remove it (I gave maintainers push permission on this branch).

…ty (for Wi-Fi drivers).

Revert "simplify InterruptIn - default parameter instead of multiple constructors"; add comment.

This reverts commit d28dbf6.
@cmonr
Copy link
Contributor

cmonr commented Mar 22, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 22, 2018

Build : FAILURE

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

@cmonr
Copy link
Contributor

cmonr commented Mar 22, 2018

ARM license issues.

/morph build

@bmcdonnell-ionx
Copy link
Contributor Author

@kjbracey-arm

Extension is reasonable from a source point of view, but introduces a binary compatibility break likely to hit the Wi-fi drivers that keep breaking.

I just realized... Did you mean that as a response to this?

Later: Would it make even more sense to have InterruptIn inherit from DigitalIn?

Meaning that no one should do this?

@mbed-ci
Copy link

mbed-ci commented Mar 22, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Mar 23, 2018

@cmonr
Copy link
Contributor

cmonr commented Mar 23, 2018

I suspect a Jenkins machine decided to call it a day a bit too early.

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Mar 23, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 23, 2018

@kjbracey
Copy link
Contributor

kjbracey commented Mar 23, 2018

@bmcdonnell-ionx - that would be another compatibility break, but just removing the no-parameter constructor is enough to be a breakage.

We don't generally guarantee no breakage - it often happens accidentally - but for this simple case we can avoid removing a constructor that at least one binary component is likely to be calling.

@cmonr
Copy link
Contributor

cmonr commented Mar 23, 2018

/morph mbed2-build

1 similar comment
@studavekar
Copy link
Contributor

/morph mbed2-build

@cmonr cmonr merged commit 801f27e into ARMmbed:master Mar 23, 2018
marcemmers pushed a commit to marcemmers/mbed-os that referenced this pull request Mar 28, 2018
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.

9 participants