Skip to content
Snippets Groups Projects
Unverified Commit cf1a5e0c authored by Sebastian Meiling's avatar Sebastian Meiling Committed by GitHub
Browse files

Merge pull request #10396 from Josar/pr/xtimer_hang/periodic_wakeup

test/xtimer_hang: use xtimer_periodic_wakeup
parents 8449324c 82d12615
No related branches found
No related tags found
No related merge requests found
...@@ -78,13 +78,16 @@ int main(void) ...@@ -78,13 +78,16 @@ int main(void)
uint32_t now = 0; uint32_t now = 0;
uint32_t start = xtimer_now_usec(); uint32_t start = xtimer_now_usec();
uint32_t until = start + (TEST_TIME_S * US_PER_SEC); uint32_t until = start + (TEST_TIME_S * US_PER_SEC);
uint32_t interval = TEST_INTERVAL_MS * US_PER_MS;
xtimer_ticks32_t last_wakeup = xtimer_now();
puts("[START]"); puts("[START]");
while((now = xtimer_now_usec()) < until) { while((now = xtimer_now_usec()) < until) {
unsigned percent = (100 * (now - start)) / (until - start); unsigned percent = (100 * (now - start)) / (until - start);
#if defined(MAIN_THREAD_PIN) #if defined(MAIN_THREAD_PIN)
gpio_set(main_pin); gpio_set(main_pin);
#endif #endif
xtimer_usleep(TEST_INTERVAL_MS * US_PER_MS); xtimer_periodic_wakeup(&last_wakeup, interval);
#if defined(MAIN_THREAD_PIN) #if defined(MAIN_THREAD_PIN)
gpio_clear(main_pin); gpio_clear(main_pin);
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment