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:
parent
a20790b0ef
commit
746f56cc3f
@ -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)))
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user