1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #15317 from aabadie/pr/sys/arduino_ztimer

sys/arduino: replace xtimer by ztimer as high-level background timer
This commit is contained in:
Francisco 2021-06-17 15:56:04 +02:00 committed by GitHub
commit a012a0849f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View File

@ -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)))

View File

@ -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

View File

@ -1,3 +1,6 @@
BOARD_INSUFFICIENT_MEMORY := \
arduino-uno \
arduino-duemilanove \
arduino-nano \
nucleo-l011k4 \
#