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

sys/arduino: use ztimer as backend high-level timer

This commit is contained in:
Alexandre Abadie 2020-10-27 18:55:27 +01:00
parent a20790b0ef
commit 746f56cc3f
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
2 changed files with 8 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