From 71501de4c62e32cfbf245506fb2701c10fdb9d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Tue, 5 Jul 2016 21:32:44 +0200 Subject: [PATCH] tests/xtimer_periodic_wakeup: Copy and adapt from xtimer_usleep_until --- .../Makefile | 0 .../main.c | 12 +++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) rename tests/{xtimer_usleep_until => xtimer_periodic_wakeup}/Makefile (100%) rename tests/{xtimer_usleep_until => xtimer_periodic_wakeup}/main.c (77%) diff --git a/tests/xtimer_usleep_until/Makefile b/tests/xtimer_periodic_wakeup/Makefile similarity index 100% rename from tests/xtimer_usleep_until/Makefile rename to tests/xtimer_periodic_wakeup/Makefile diff --git a/tests/xtimer_usleep_until/main.c b/tests/xtimer_periodic_wakeup/main.c similarity index 77% rename from tests/xtimer_usleep_until/main.c rename to tests/xtimer_periodic_wakeup/main.c index 5ee77acf71..479c5d0b86 100644 --- a/tests/xtimer_usleep_until/main.c +++ b/tests/xtimer_periodic_wakeup/main.c @@ -30,23 +30,25 @@ int32_t res[NUMOF]; int main(void) { - puts("xtimer_usleep_until test application.\n"); + puts("xtimer_periodic_wakeup test application.\n"); uint32_t interval = NUMOF; int32_t max_diff = INT32_MIN; int32_t min_diff = INT32_MAX; for (int i = 0; i < NUMOF; i++) { - printf("Testing interval %u... (now=%"PRIu32")\n", (unsigned)interval, xtimer_now()); + uint32_t now = xtimer_now(); + printf("Testing interval %" PRIu32 "... (now=%" PRIu32 ")\n", interval, now); uint32_t last_wakeup = xtimer_now(); uint32_t before = last_wakeup; - xtimer_usleep_until(&last_wakeup, (unsigned)interval); - res[i] = (xtimer_now()-before)-interval; + xtimer_periodic_wakeup(&last_wakeup, interval); + now = xtimer_now(); + res[i] = (now - before) - interval; interval -= 1; } for (int i = 0; i < NUMOF; i++) { - printf("%4d diff=%"PRIi32"\n", NUMOF-i, res[i]); + printf("%4d diff=%" PRIi32 "\n", NUMOF - i, res[i]); if (res[i] > max_diff) { max_diff = res[i];