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:
commit
a012a0849f
@ -9,7 +9,8 @@ ifneq (,$(filter arduino,$(USEMODULE)))
|
|||||||
SKETCH_MODULE ?= arduino_sketches
|
SKETCH_MODULE ?= arduino_sketches
|
||||||
USEMODULE += $(SKETCH_MODULE)
|
USEMODULE += $(SKETCH_MODULE)
|
||||||
USEMODULE += fmt
|
USEMODULE += fmt
|
||||||
USEMODULE += xtimer
|
USEMODULE += ztimer_usec
|
||||||
|
USEMODULE += ztimer_msec
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter arduino_pwm,$(FEATURES_USED)))
|
ifneq (,$(filter arduino_pwm,$(FEATURES_USED)))
|
||||||
|
|||||||
@ -19,7 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "xtimer.h"
|
#include "assert.h"
|
||||||
|
#include "ztimer.h"
|
||||||
#include "periph/gpio.h"
|
#include "periph/gpio.h"
|
||||||
#include "periph/adc.h"
|
#include "periph/adc.h"
|
||||||
#include "periph/pwm.h"
|
#include "periph/pwm.h"
|
||||||
@ -60,22 +61,22 @@ int digitalRead(int pin)
|
|||||||
|
|
||||||
void delay(unsigned long msec)
|
void delay(unsigned long msec)
|
||||||
{
|
{
|
||||||
xtimer_usleep(msec * US_PER_MS);
|
ztimer_sleep(ZTIMER_MSEC, msec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delayMicroseconds(unsigned long usec)
|
void delayMicroseconds(unsigned long usec)
|
||||||
{
|
{
|
||||||
xtimer_usleep(usec);
|
ztimer_sleep(ZTIMER_USEC, usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long micros()
|
unsigned long micros()
|
||||||
{
|
{
|
||||||
return xtimer_now_usec();
|
return ztimer_now(ZTIMER_USEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long millis()
|
unsigned long millis()
|
||||||
{
|
{
|
||||||
return xtimer_now_usec64() / US_PER_MS;
|
return ztimer_now(ZTIMER_MSEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MODULE_PERIPH_ADC
|
#if MODULE_PERIPH_ADC
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
BOARD_INSUFFICIENT_MEMORY := \
|
BOARD_INSUFFICIENT_MEMORY := \
|
||||||
|
arduino-uno \
|
||||||
|
arduino-duemilanove \
|
||||||
|
arduino-nano \
|
||||||
nucleo-l011k4 \
|
nucleo-l011k4 \
|
||||||
#
|
#
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user