mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Kaspar Schleiser
f85e21d23a
xtimer_usleep_until's internal logic has changed, always setting &last_wakeup to the expected instead of real value. In order to make this test output valid values, this commit adapts it.
52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
/*
|
|
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
* directory for more details.
|
|
*/
|
|
|
|
/**
|
|
* @ingroup tests
|
|
* @{
|
|
*
|
|
* @file
|
|
* @brief timer test application
|
|
*
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
*
|
|
* @}
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include "xtimer.h"
|
|
#include "periph_conf.h"
|
|
|
|
#define NUMOF 1000
|
|
|
|
uint32_t res[NUMOF];
|
|
|
|
int main(void)
|
|
{
|
|
puts("xtimer_usleep_until test application.\n");
|
|
|
|
uint32_t interval = 1000;
|
|
|
|
for (int i = 0; i < NUMOF; i++) {
|
|
printf("Testing interval %u...\n", (unsigned)interval);
|
|
uint32_t last_wakeup = xtimer_now();
|
|
uint32_t before = last_wakeup;
|
|
xtimer_usleep_until(&last_wakeup, (unsigned)interval);
|
|
uint32_t diff = (xtimer_now()-before)-interval;
|
|
res[i] = diff;
|
|
interval -= 1;
|
|
}
|
|
|
|
for (int i = 0; i < NUMOF; i++) {
|
|
printf("%4d diff=%i\n", i, (int)res[i]);
|
|
}
|
|
|
|
printf("\nTest complete.\n");
|
|
return 0;
|
|
}
|