Merge pull request #563 from cmorty/etimer_reset_set

Add function etimer_reset_set.
This commit is contained in:
Fredrik Österlind 2015-08-27 13:08:37 +02:00
commit c3f61e2c79
2 changed files with 21 additions and 0 deletions

View File

@ -181,6 +181,14 @@ etimer_set(struct etimer *et, clock_time_t interval)
}
/*---------------------------------------------------------------------------*/
void
etimer_reset_with_new_interval(struct etimer *et, clock_time_t interval)
{
timer_reset(&et->timer);
et->timer.interval = interval;
add_timer(et);
}
/*---------------------------------------------------------------------------*/
void
etimer_reset(struct etimer *et)
{
timer_reset(&et->timer);

View File

@ -114,6 +114,19 @@ CCIF void etimer_set(struct etimer *et, clock_time_t interval);
*/
CCIF void etimer_reset(struct etimer *et);
/**
* \brief Reset an event timer with a new interval.
* \param et A pointer to the event timer.
* \param interval The interval before the timer expires.
*
* This function very similar to etimer_reset. Opposed to
* etimer_reset it is possible to change the timout.
* This allows accurate, non-periodic timers without drift.
*
* \sa etimer_reset()
*/
void etimer_reset_with_new_interval(struct etimer *et, clock_time_t interval);
/**
* \brief Restart an event timer from the current point in time
* \param et A pointer to the event timer.