Skip to content

Commit 87421b4

Browse files
authored
Merge pull request #334 from soburi/fix_builtin_led_macro
Arduino.h: Correct LED_BUILTIN define order
2 parents 9009b85 + 5e09e9e commit 87421b4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cores/arduino/Arduino.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(node, gpios, 0)), \
4343
DT_PHA_BY_IDX(node, gpios, 0, pin))
4444

45-
#ifndef LED_BUILTIN
46-
4745
/* Return the index of it if matched, oterwise return 0 */
4846
#define LED_BUILTIN_INDEX_BY_REG_AND_PINNUM(n, p, i, dev, num) \
4947
(DIGITAL_PIN_EXISTS(n, p, i, dev, num) ? i : 0)
@@ -62,7 +60,7 @@
6260
DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0, pin)) > 0)
6361
#warning "pin not found in digital_pin_gpios"
6462
#else
65-
#define LED_BUILTIN \
63+
#define ZARD_LED_BUILTIN \
6664
DIGITAL_PIN_GPIOS_FIND_PIN( \
6765
DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0)), \
6866
DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0, pin))
@@ -77,15 +75,13 @@
7775
DT_PHA_BY_IDX(DT_ALIAS(led0), gpios, 0, pin)) > 0)
7876
#warning "pin not found in digital_pin_gpios"
7977
#else
80-
#define LED_BUILTIN \
78+
#define ZARD_LED_BUILTIN \
8179
DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_ALIAS(led0), gpios, 0)), \
8280
DT_PHA_BY_IDX(DT_ALIAS(led0), gpios, 0, pin))
8381
#endif
8482

8583
#endif // builtin_led_gpios
8684

87-
#endif // LED_BUILTIN
88-
8985
#define DN_ENUMS(n, p, i) D##i = i
9086

9187
/*
@@ -142,6 +138,11 @@ void analogReadResolution(int bits);
142138
void analogWriteResolution(int bits);
143139

144140
#include <variant.h>
141+
142+
#if !defined(LED_BUILTIN) && defined(ZARD_LED_BUILTIN)
143+
#define LED_BUILTIN ZARD_LED_BUILTIN
144+
#endif // LED_BUILTIN
145+
145146
#ifdef __cplusplus
146147
#include <SerialUSB.h>
147148
#include <zephyrSerial.h>

0 commit comments

Comments
 (0)