Skip to content

Commit e623510

Browse files
committed
attachInterrupt() on SAMD has a different Semantic :-( see: https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/ paragraph: Syntax
1 parent 29613ac commit e623510

File tree

27 files changed

+141
-12
lines changed

27 files changed

+141
-12
lines changed

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ The latest version may not be released!
33
See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master
44

55
# 4.4.2
6-
- Support for SAMD51 timer3 if timer 5 is not available (Adafruit ItsyBitsy M4)
6+
- Support for SAMD51 timer3 if timer 5 is not available (Adafruit ItsyBitsy M4).
7+
- attachInterrupt() on SAMD has a different semantic :-(. See: https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/.
78

89
# 4.4.1
910
- Support for ESP core 3.x by akellai.

examples/AllProtocolsOnLCD/PinDefinitionsAndMore.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* ATtiny1604 2 3|PA5 %
4040
* ATtiny816 14|PA1 16|PA3 1|PA5 MegaTinyCore
4141
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
42+
* MKR* 1 3 4
4243
* SAMD 2 3 4
4344
* ESP8266 14|D5 12|D6 %
4445
* ESP32 15 4 27
@@ -288,7 +289,11 @@ void noTone(uint8_t aPinNumber){
288289
#define _IR_TIMING_TEST_PIN 7
289290

290291
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
292+
# if defined(USE_ARDUINO_MKR_PIN_LAYOUT)
293+
#define IR_RECEIVE_PIN 1 // Pin 2 on MKR is not interrupt capable, see https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/
294+
# else
291295
#define IR_RECEIVE_PIN 2
296+
# endif
292297
#define IR_SEND_PIN 3
293298
#define TONE_PIN 4
294299
#define APPLICATION_PIN 5

examples/ControlRelay/PinDefinitionsAndMore.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* ATtiny1604 2 3|PA5 %
4040
* ATtiny816 14|PA1 16|PA3 1|PA5 MegaTinyCore
4141
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
42+
* MKR* 1 3 4
4243
* SAMD 2 3 4
4344
* ESP8266 14|D5 12|D6 %
4445
* ESP32 15 4 27
@@ -288,7 +289,11 @@ void noTone(uint8_t aPinNumber){
288289
#define _IR_TIMING_TEST_PIN 7
289290

290291
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
292+
# if defined(USE_ARDUINO_MKR_PIN_LAYOUT)
293+
#define IR_RECEIVE_PIN 1 // Pin 2 on MKR is not interrupt capable, see https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/
294+
# else
291295
#define IR_RECEIVE_PIN 2
296+
# endif
292297
#define IR_SEND_PIN 3
293298
#define TONE_PIN 4
294299
#define APPLICATION_PIN 5

examples/IRDispatcherDemo/PinDefinitionsAndMore.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* ATtiny1604 2 3|PA5 %
4040
* ATtiny816 14|PA1 16|PA3 1|PA5 MegaTinyCore
4141
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
42+
* MKR* 1 3 4
4243
* SAMD 2 3 4
4344
* ESP8266 14|D5 12|D6 %
4445
* ESP32 15 4 27
@@ -288,7 +289,11 @@ void noTone(uint8_t aPinNumber){
288289
#define _IR_TIMING_TEST_PIN 7
289290

290291
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
292+
# if defined(USE_ARDUINO_MKR_PIN_LAYOUT)
293+
#define IR_RECEIVE_PIN 1 // Pin 2 on MKR is not interrupt capable, see https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/
294+
# else
291295
#define IR_RECEIVE_PIN 2
296+
# endif
292297
#define IR_SEND_PIN 3
293298
#define TONE_PIN 4
294299
#define APPLICATION_PIN 5

examples/IRremoteExtensionTest/PinDefinitionsAndMore.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* ATtiny1604 2 3|PA5 %
4040
* ATtiny816 14|PA1 16|PA3 1|PA5 MegaTinyCore
4141
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
42+
* MKR* 1 3 4
4243
* SAMD 2 3 4
4344
* ESP8266 14|D5 12|D6 %
4445
* ESP32 15 4 27
@@ -288,7 +289,11 @@ void noTone(uint8_t aPinNumber){
288289
#define _IR_TIMING_TEST_PIN 7
289290

290291
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
292+
# if defined(USE_ARDUINO_MKR_PIN_LAYOUT)
293+
#define IR_RECEIVE_PIN 1 // Pin 2 on MKR is not interrupt capable, see https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/
294+
# else
291295
#define IR_RECEIVE_PIN 2
296+
# endif
292297
#define IR_SEND_PIN 3
293298
#define TONE_PIN 4
294299
#define APPLICATION_PIN 5

examples/MicroGirs/PinDefinitionsAndMore.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* ATtiny1604 2 3|PA5 %
4040
* ATtiny816 14|PA1 16|PA3 1|PA5 MegaTinyCore
4141
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
42+
* MKR* 1 3 4
4243
* SAMD 2 3 4
4344
* ESP8266 14|D5 12|D6 %
4445
* ESP32 15 4 27
@@ -288,7 +289,11 @@ void noTone(uint8_t aPinNumber){
288289
#define _IR_TIMING_TEST_PIN 7
289290

290291
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
292+
# if defined(USE_ARDUINO_MKR_PIN_LAYOUT)
293+
#define IR_RECEIVE_PIN 1 // Pin 2 on MKR is not interrupt capable, see https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/
294+
# else
291295
#define IR_RECEIVE_PIN 2
296+
# endif
292297
#define IR_SEND_PIN 3
293298
#define TONE_PIN 4
294299
#define APPLICATION_PIN 5

examples/ReceiveAndSend/PinDefinitionsAndMore.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* ATtiny1604 2 3|PA5 %
4040
* ATtiny816 14|PA1 16|PA3 1|PA5 MegaTinyCore
4141
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
42+
* MKR* 1 3 4
4243
* SAMD 2 3 4
4344
* ESP8266 14|D5 12|D6 %
4445
* ESP32 15 4 27
@@ -288,7 +289,11 @@ void noTone(uint8_t aPinNumber){
288289
#define _IR_TIMING_TEST_PIN 7
289290

290291
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
292+
# if defined(USE_ARDUINO_MKR_PIN_LAYOUT)
293+
#define IR_RECEIVE_PIN 1 // Pin 2 on MKR is not interrupt capable, see https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/
294+
# else
291295
#define IR_RECEIVE_PIN 2
296+
# endif
292297
#define IR_SEND_PIN 3
293298
#define TONE_PIN 4
294299
#define APPLICATION_PIN 5

examples/ReceiveAndSendDistanceWidth/PinDefinitionsAndMore.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* ATtiny1604 2 3|PA5 %
4040
* ATtiny816 14|PA1 16|PA3 1|PA5 MegaTinyCore
4141
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
42+
* MKR* 1 3 4
4243
* SAMD 2 3 4
4344
* ESP8266 14|D5 12|D6 %
4445
* ESP32 15 4 27
@@ -288,7 +289,11 @@ void noTone(uint8_t aPinNumber){
288289
#define _IR_TIMING_TEST_PIN 7
289290

290291
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
292+
# if defined(USE_ARDUINO_MKR_PIN_LAYOUT)
293+
#define IR_RECEIVE_PIN 1 // Pin 2 on MKR is not interrupt capable, see https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/
294+
# else
291295
#define IR_RECEIVE_PIN 2
296+
# endif
292297
#define IR_SEND_PIN 3
293298
#define TONE_PIN 4
294299
#define APPLICATION_PIN 5

examples/ReceiveAndSendHob2Hood/PinDefinitionsAndMore.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* ATtiny1604 2 3|PA5 %
4040
* ATtiny816 14|PA1 16|PA3 1|PA5 MegaTinyCore
4141
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
42+
* MKR* 1 3 4
4243
* SAMD 2 3 4
4344
* ESP8266 14|D5 12|D6 %
4445
* ESP32 15 4 27
@@ -288,7 +289,11 @@ void noTone(uint8_t aPinNumber){
288289
#define _IR_TIMING_TEST_PIN 7
289290

290291
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
292+
# if defined(USE_ARDUINO_MKR_PIN_LAYOUT)
293+
#define IR_RECEIVE_PIN 1 // Pin 2 on MKR is not interrupt capable, see https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/
294+
# else
291295
#define IR_RECEIVE_PIN 2
296+
# endif
292297
#define IR_SEND_PIN 3
293298
#define TONE_PIN 4
294299
#define APPLICATION_PIN 5

examples/ReceiveDemo/PinDefinitionsAndMore.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* ATtiny1604 2 3|PA5 %
4040
* ATtiny816 14|PA1 16|PA3 1|PA5 MegaTinyCore
4141
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
42+
* MKR* 1 3 4
4243
* SAMD 2 3 4
4344
* ESP8266 14|D5 12|D6 %
4445
* ESP32 15 4 27
@@ -288,7 +289,11 @@ void noTone(uint8_t aPinNumber){
288289
#define _IR_TIMING_TEST_PIN 7
289290

290291
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
292+
# if defined(USE_ARDUINO_MKR_PIN_LAYOUT)
293+
#define IR_RECEIVE_PIN 1 // Pin 2 on MKR is not interrupt capable, see https://www.arduino.cc/reference/tr/language/functions/external-interrupts/attachinterrupt/
294+
# else
291295
#define IR_RECEIVE_PIN 2
296+
# endif
292297
#define IR_SEND_PIN 3
293298
#define TONE_PIN 4
294299
#define APPLICATION_PIN 5

0 commit comments

Comments
 (0)