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:
parent
35f329e05c
commit
d8cf2517ed
@ -4,5 +4,6 @@ include ../Makefile.tests_common
|
||||
BOARD_INSUFFICIENT_MEMORY := nucleo32-f031
|
||||
|
||||
USEMODULE += core_thread_flags
|
||||
USEMODULE += xtimer
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user