Skip to content

Changes to attachInterrupt() prevent pin set-up with NULL callback pointer #309

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

Open
ghost opened this issue Feb 18, 2018 · 2 comments
Open

Comments

@ghost
Copy link

ghost commented Feb 18, 2018

Changes to the attachInterrupt() function code prevents the pin from being set-up when a NULL pointer callback is detected.

The older attachInterrupt() code allowed for both, enabling the attachInterrupt() to be used for setting up events on the SAMD21's event system, with the callback argument being passed as NULL or 0. Unfortunately, this is now not possible.

The event system can be used to allow pin interrupts to trigger TCC timer capture, please see Arduino Zero forum thread: https://forum.arduino.cc/index.php?topic=396804.0. The change to attachInterrupt() breaks most of the code examples on this thread.

The workaround is to use a dummy callback in place on the NULL, this solution however is rather inelegant.

@facchinm
Copy link
Member

This is the related code change (9a49ce2#diff-2d6f462f44c0386e70bfb9e3ba804d5bR84). I must admit that I agree with @martinl1 , the SAMD21 case is quite particular but not unique, so we should revert part of the patch (leaving the null check but configuring the interrupt anyway) @cmaglie

@ghost
Copy link
Author

ghost commented Feb 19, 2018

Thanks @facchinm,

Just also like to say thank you to all the developers working on the SAMD21 Arduino core, much appreciated.

boseji pushed a commit to go-ut/combined-ArduinoCore-samd that referenced this issue Nov 10, 2021
Bugfix - waiting for first ADC read to complete after ADC enable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant