2015-08-14 16:02:32 +02:00
|
|
|
/*
|
|
|
|
* 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 xtimer_examples
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief example application for setting a periodic wakeup
|
|
|
|
*
|
|
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
*
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "xtimer.h"
|
2016-07-07 16:15:33 +02:00
|
|
|
#include "timex.h"
|
2015-08-14 16:02:32 +02:00
|
|
|
|
|
|
|
/* set interval to 1 second */
|
2017-01-17 16:44:05 +01:00
|
|
|
#define INTERVAL (1U * US_PER_SEC)
|
2015-08-14 16:02:32 +02:00
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2016-07-05 21:32:44 +02:00
|
|
|
xtimer_ticks32_t last_wakeup = xtimer_now();
|
2015-08-14 16:02:32 +02:00
|
|
|
|
|
|
|
while(1) {
|
2016-07-07 16:15:33 +02:00
|
|
|
xtimer_periodic_wakeup(&last_wakeup, INTERVAL);
|
2016-07-05 21:32:44 +02:00
|
|
|
printf("slept until %" PRIu32 "\n", xtimer_usec_from_ticks(xtimer_now()));
|
2015-08-14 16:02:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|