Skip to content

Commit 0333bcc

Browse files
committed
Add macro to find pins by node
1 parent 219fe72 commit 0333bcc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cores/arduino/Arduino.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
#undef DIGITAL_PIN_CHECK_UNIQUE
3838
#endif
3939

40+
// Helper macro to get Arduino pin number from device tree alias
41+
#define DIGITAL_PIN_GPIOS_FIND_NODE(node) \
42+
DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(node, gpios, 0)), \
43+
DT_PHA_BY_IDX(node, gpios, 0, pin))
44+
4045
#ifndef LED_BUILTIN
4146

4247
/* Return the index of it if matched, oterwise return 0 */

0 commit comments

Comments
 (0)