Skip to content

Commit dd45536

Browse files
committed
Arduino.h: Add digitalPinToInterrupt
- Return the same number as long as not more than number of digital pins. - This does not seem to be present in ArduinoCoreAPI but defined for all Arduino boards (and microblocks has started using it). - Also present in arduino docs [1] [1]: https://www.arduino.cc/reference/en/language/functions/external-interrupts/digitalpintointerrupt/ Signed-off-by: Ayush Singh <[email protected]>
1 parent 0af5724 commit dd45536

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: cores/arduino/Arduino.h

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ enum analogPins { DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user),
9797

9898
#endif
9999

100+
static inline int digitalPinToInterrupt(pin_size_t pin) {
101+
return (pin < NUM_OF_DIGITAL_PINS) ? pin : -1;
102+
}
103+
100104
void interrupts(void);
101105
void noInterrupts(void);
102106

0 commit comments

Comments
 (0)