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

test/evtimer_underflow: test shall not need a blocking timer set

xtimer for short timouts is blocking (spin) this was needed for this test to pass
by sleeping in main we no longer need the timer set to wait
This commit is contained in:
Karl Fessel 2021-12-08 19:26:03 +01:00
parent 95767ec9b5
commit 937efda843
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,6 @@
include ../Makefile.tests_common
USEMODULE += evtimer
USEMODULE += xtimer
include $(RIOTBASE)/Makefile.include

View File

@ -23,6 +23,7 @@
#include "evtimer_msg.h"
#include "thread.h"
#include "msg.h"
#include "xtimer.h"
#define WORKER_MSG_QUEUE_SIZE (8)
@ -45,7 +46,7 @@ static evtimer_msg_event_t events[] = {
/* This thread will print the drift to stdout once per second */
void *worker_thread(void *arg)
{
(void) arg;
(void)arg;
msg_init_queue(worker_msg_queue, WORKER_MSG_QUEUE_SIZE);
while (1) {
@ -58,6 +59,11 @@ void *worker_thread(void *arg)
}
}
void sleep_msec(uint16_t t)
{
xtimer_msleep(t);
}
int main(void)
{
evtimer_init_msg(&evtimer);
@ -67,9 +73,11 @@ int main(void)
THREAD_PRIORITY_MAIN - 1,
THREAD_CREATE_STACKTEST,
worker_thread, NULL, "worker");
while (1) {
for (unsigned i = 0; i < NEVENTS; i++) {
evtimer_add_msg(&evtimer, &events[i], pid);
sleep_msec(10);
}
}
}