Skip to content

Commit 0e52b77

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. Signed-off-by: Ayush Singh <[email protected]>
1 parent 0af5724 commit 0e52b77

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: cores/arduino/Arduino.h

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

9898
#endif
9999

100+
static inline int digitalPinToInterrupt(pin_size_t pin)
101+
{
102+
return (pin < NUM_OF_DIGITAL_PINS) ? pin : -1;
103+
}
104+
100105
void interrupts(void);
101106
void noInterrupts(void);
102107

0 commit comments

Comments
 (0)