From 746f56cc3f827ea35df11077053200fae26da26a Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Tue, 27 Oct 2020 18:55:27 +0100 Subject: [PATCH 1/2] sys/arduino: use ztimer as backend high-level timer --- sys/Makefile.dep | 3 ++- sys/arduino/base.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/Makefile.dep b/sys/Makefile.dep index 2c578c67a5..f666c0c60e 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -9,7 +9,8 @@ ifneq (,$(filter arduino,$(USEMODULE))) SKETCH_MODULE ?= arduino_sketches USEMODULE += $(SKETCH_MODULE) USEMODULE += fmt - USEMODULE += xtimer + USEMODULE += ztimer_usec + USEMODULE += ztimer_msec endif ifneq (,$(filter arduino_pwm,$(FEATURES_USED))) diff --git a/sys/arduino/base.cpp b/sys/arduino/base.cpp index b1d58e7d41..51e90cc966 100644 --- a/sys/arduino/base.cpp +++ b/sys/arduino/base.cpp @@ -19,7 +19,8 @@ */ extern "C" { -#include "xtimer.h" +#include "assert.h" +#include "ztimer.h" #include "periph/gpio.h" #include "periph/adc.h" #include "periph/pwm.h" @@ -60,22 +61,22 @@ int digitalRead(int pin) void delay(unsigned long msec) { - xtimer_usleep(msec * US_PER_MS); + ztimer_sleep(ZTIMER_MSEC, msec); } void delayMicroseconds(unsigned long usec) { - xtimer_usleep(usec); + ztimer_sleep(ZTIMER_USEC, usec); } unsigned long micros() { - return xtimer_now_usec(); + return ztimer_now(ZTIMER_USEC); } unsigned long millis() { - return xtimer_now_usec64() / US_PER_MS; + return ztimer_now(ZTIMER_MSEC); } #if MODULE_PERIPH_ADC From e30a107329cea99b252a535d6b1e082c7202dbd0 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Thu, 17 Jun 2021 10:29:14 +0200 Subject: [PATCH 2/2] tests/sys_arduino: skip atmega328p based boards from ci --- tests/sys_arduino/Makefile.ci | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/sys_arduino/Makefile.ci b/tests/sys_arduino/Makefile.ci index b9ff275375..6dd33c6f04 100644 --- a/tests/sys_arduino/Makefile.ci +++ b/tests/sys_arduino/Makefile.ci @@ -1,3 +1,6 @@ BOARD_INSUFFICIENT_MEMORY := \ + arduino-uno \ + arduino-duemilanove \ + arduino-nano \ nucleo-l011k4 \ #