Skip to content

Commit 730e7c9

Browse files
committed
x
1 parent a8239ea commit 730e7c9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cores/arduino/zephyrCommon.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <Arduino.h>
88
#include "zephyrInternal.h"
9+
#include <zephyr/sys/util_macro.h>
910

1011
static const struct gpio_dt_spec arduino_pins[] = {DT_FOREACH_PROP_ELEM_SEP(
1112
DT_PATH(zephyr_user), digital_pin_gpios, GPIO_DT_SPEC_GET_BY_IDX, (, ))};
@@ -242,8 +243,17 @@ size_t analog_pin_index(pin_size_t pinNumber) {
242243
static unsigned int irq_key;
243244
static bool interrupts_disabled = false;
244245
} // namespace
246+
//
247+
248+
#define Dx(x) D ## x
249+
#define DXx(x) DX ## x
250+
#define PRINT_PIN(Px, _) printk(STRINGIFY(DXX(PX)) "%p:%d - %p:%d", arduino_pins[Dx(Px)].port, arduino_pins[Dx(Px)].pin, local_gpio_port(DXx(Px)), local_gpio_pin(DXx(Px)));
245251

246252
void yield(void) {
253+
254+
LISTIFY(23, PRINT_PIN, ());
255+
256+
247257
k_yield();
248258
}
249259

@@ -276,6 +286,11 @@ PinStatus digitalRead(pin_size_t pinNumber) {
276286
return (gpio_pin_get_dt(&arduino_pins[pinNumber]) == 1) ? HIGH : LOW;
277287
}
278288

289+
struct pin_timer {
290+
struct k_timer timer;
291+
struct gpio_dt_spec spec;
292+
};
293+
279294
struct k_timer arduino_pin_timers[ARRAY_SIZE(arduino_pins)];
280295
struct k_timer arduino_pin_timers_timeout[ARRAY_SIZE(arduino_pins)];
281296

0 commit comments

Comments
 (0)