Skip to content

Make attachInterrupt work as documented #117

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 6 commits into from
Apr 19, 2016

Conversation

sandeepmistry
Copy link
Contributor

From the attachInterrupt docs, the recommended usage is:

attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);

This currently does not work with the SAMD core because digitalPinToInterrupt is used inside attachInterrupt, so the pin number must be passed in.

This patch addresses this by changing digitalPinToInterrupt to return the argument passed in. attachInterrupt and detachInterrupt will use g_APinDescription[pin].ulExtInt; to map the pin to interrupt number directly.

It also moves digitalPinToInterrupt inside Arduino.h (if ARDUINO_SAMD_VARIANT_COMPLIANCE is >= 1.6.5). Existing behaviour will be used in variants with older compliance levels.

I've also added a new change log for variant compliance changes.

@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b67_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Make attachInterrupt work as documented #117
  5. Select one of the boards under SAMD Pull Request Make attachInterrupt work as documented #117 in Tools->Board menu
  6. Compile/Upload as usual

@sandeepmistry sandeepmistry force-pushed the attachInterrupt-match-docs branch from 7c2c265 to 1c8071a Compare April 6, 2016 17:41
@sandeepmistry
Copy link
Contributor Author

@cmaglie I've rebased this, bumped compliance level to 1.6.6 (since 1.6.5 is released) and also applied to the MKR1000 variant. Please review.

@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b77_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Make attachInterrupt work as documented #117
  5. Select one of the boards under SAMD Pull Request Make attachInterrupt work as documented #117 in Tools->Board menu
  6. Compile/Upload as usual

@cmaglie cmaglie merged commit 1c8071a into arduino:master Apr 19, 2016
@cmaglie cmaglie added this to the Release 1.6.6 milestone Apr 19, 2016
@sandeepmistry sandeepmistry deleted the attachInterrupt-match-docs branch April 19, 2016 15:13
boseji pushed a commit to go-ut/combined-ArduinoCore-samd that referenced this pull request May 30, 2020
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.

3 participants