Skip to content

Commit e653024

Browse files
committed
Arduino.h: Correct LED_BUILTIN define order
Correct the order of LED_BUILTIN definitions so that board-specific definitions of LED_BUILTIN take precedence. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
1 parent 7d51734 commit e653024

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
@@ -33,8 +33,6 @@
3333

3434
#undef DIGITAL_PIN_CHECK_UNIQUE
3535

36-
#ifndef LED_BUILTIN
37-
3836
/* Return the index of it if matched, oterwise return 0 */
3937
#define LED_BUILTIN_INDEX_BY_REG_AND_PINNUM(n, p, i, dev, num) \
4038
(DIGITAL_PIN_EXISTS(n, p, i, dev, num) ? i : 0)
@@ -53,7 +51,7 @@
5351
DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0, pin)) > 0)
5452
#warning "pin not found in digital_pin_gpios"
5553
#else
56-
#define LED_BUILTIN \
54+
#define LED_BUILTIN_ \
5755
DIGITAL_PIN_GPIOS_FIND_PIN( \
5856
DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0)), \
5957
DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0, pin))
@@ -67,15 +65,13 @@
6765
DT_PHA_BY_IDX(DT_ALIAS(led0), gpios, 0, pin)) > 0)
6866
#warning "pin not found in digital_pin_gpios"
6967
#else
70-
#define LED_BUILTIN \
68+
#define LED_BUILTIN_ \
7169
DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_ALIAS(led0), gpios, 0)), \
7270
DT_PHA_BY_IDX(DT_ALIAS(led0), gpios, 0, pin))
7371
#endif
7472

7573
#endif // builtin_led_gpios
7674

77-
#endif // LED_BUILTIN
78-
7975
#define DN_ENUMS(n, p, i) D##i = i
8076

8177
/*
@@ -103,6 +99,11 @@ void noInterrupts(void);
10399
int digitalPinToInterrupt(pin_size_t pin);
104100

105101
#include <variant.h>
102+
103+
#if !defined(LED_BUILTIN) && defined(LED_BUILTIN_)
104+
#define LED_BUILTIN LED_BUILTIN_
105+
#endif // LED_BUILTIN
106+
106107
#ifdef __cplusplus
107108
#include <zephyrPrint.h>
108109
#include <zephyrSerial.h>

0 commit comments

Comments
 (0)