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

tests/thread_flags: add xtimer_set_timeout_flag() test

This commit is contained in:
Kaspar Schleiser 2017-09-01 23:54:36 +02:00
parent 35f329e05c
commit d8cf2517ed
2 changed files with 10 additions and 0 deletions

View File

@ -4,5 +4,6 @@ include ../Makefile.tests_common
BOARD_INSUFFICIENT_MEMORY := nucleo32-f031
USEMODULE += core_thread_flags
USEMODULE += xtimer
include $(RIOTBASE)/Makefile.include

View File

@ -20,6 +20,7 @@
#include <stdio.h>
#include "thread.h"
#include "xtimer.h"
static char stack[THREAD_STACKSIZE_MAIN];
@ -85,6 +86,14 @@ int main(void)
while(!done) {};
puts("main: setting 100ms timeout...");
xtimer_t t;
uint32_t before = xtimer_now_usec();
xtimer_set_timeout_flag(&t, 100000);
thread_flags_wait_any(THREAD_FLAG_TIMEOUT);
uint32_t diff = xtimer_now_usec() - before;
printf("main: timeout triggered. time passed: %uus\n", (unsigned)diff);
puts("test finished.");
return 0;