Skip to content

Commit 6ed2da3

Browse files
committed
x
1 parent afee331 commit 6ed2da3

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

cores/arduino/Arduino.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,18 @@
2424
#define SUM_NGPIOS(i, n, p) \
2525
DT_PROP(DT_PROP_BY_IDX(n, p, i), ngpios)
2626

27-
#define GPIO_OFFSET(n, p, i) \
28-
int hoge##i = LISTIFY(UTIL_INC(i), SUM_NGPIOS, (+), n, p);
27+
#define ACCUM_NGPIOS(n, p, i) \
28+
(LISTIFY(UTIL_INC(i), SUM_NGPIOS, (+), n, p))
29+
30+
#define GPIO_DEVICE_INSTANCE(n, p, i) DEVICE_DT_GET(DT_PROP_BY_IDX(n, p, i))
31+
32+
static const int arduino_ngpios_accum[] = {
33+
DT_FOREACH_PROP_ELEM_SEP(DT_PATH(zephyr_user), gpios, ACCUM_NGPIOS, (,))
34+
};
35+
36+
static const struct device * arduino_gpio_devices[] = {
37+
DT_FOREACH_PROP_ELEM_SEP(DT_PATH(zephyr_user), gpios, GPIO_DEVICE_INSTANCE, (,))
38+
};
2939

3040
#define DIGITAL_PIN_EXISTS(n, p, i, dev, num) \
3141
(((dev == DT_REG_ADDR(DT_PHANDLE_BY_IDX(n, p, i))) && \

cores/arduino/zephyrCommon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <Arduino.h>
88
#include "zephyrInternal.h"
99

10-
DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), gpios, GPIO_OFFSET)
10+
//DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), gpios, GPIO_OFFSET)
1111

1212
static const struct gpio_dt_spec arduino_pins[] = {DT_FOREACH_PROP_ELEM_SEP(
1313
DT_PATH(zephyr_user), digital_pin_gpios, GPIO_DT_SPEC_GET_BY_IDX, (, ))};

0 commit comments

Comments
 (0)