-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Interrupt in pin mode #6239
Conversation
There was a problem hiding this 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
.
drivers/InterruptIn.h
Outdated
@@ -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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Is there something I need to do to resolve these CI failures? |
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/morph build |
Build : SUCCESSBuild number : 1354 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1008 |
Test : SUCCESSBuild number : 1136 |
/morph mbed2-build |
There was a problem hiding this 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).
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 |
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? |
drivers/InterruptIn.cpp
Outdated
@@ -19,16 +19,33 @@ | |||
|
|||
namespace mbed { | |||
|
|||
// Note: This single-parameter constructor exists to maintain binary | |||
// compatibility for the Wi-Fi drivers. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
e685cb6
to
8d2214f
Compare
/morph build |
Build : FAILUREBuild number : 1530 |
ARM license issues. /morph build |
@kjbracey-arm
I just realized... Did you mean that as a response to this?
Meaning that no one should do this? |
Build : SUCCESSBuild number : 1534 Triggering tests/morph test |
Exporter Build : FAILUREBuild number : 1174 |
I suspect a Jenkins machine decided to call it a day a bit too early. /morph export-build |
Exporter Build : SUCCESSBuild number : 1176 |
Test : SUCCESSBuild number : 1314 |
@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. |
/morph mbed2-build |
1 similar comment
/morph mbed2-build |
Description
Currently there's no way to specify the
PinMode
(PullUp
,PullDown
, etc.) in theInterruptIn
constructor. So I added one, likeDigitalIn
.Later: Would it make even more sense to have
InterruptIn
inherit fromDigitalIn
?Pull request type