Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of UIPEthernet by
Timer library
The timer library provides functions for setting, resetting and restarting timers, and for checking if a timer has expired. More...
Data Structures | |
struct | uip_timer |
A timer. More... | |
Files | |
file | uip_timer.c |
Timer library implementation. | |
file | uip_timer.h |
Timer library header file. | |
Functions | |
void | uip_timer_set (struct uip_timer *t, clock_time_t interval) |
Set a timer. | |
void | uip_timer_reset (struct uip_timer *t) |
Reset the timer with the same interval. | |
void | uip_timer_restart (struct uip_timer *t) |
Restart the timer from the current point in time. | |
int | uip_timer_expired (struct uip_timer *t) |
Check if a timer has expired. |
Detailed Description
The timer library provides functions for setting, resetting and restarting timers, and for checking if a timer has expired.
An application must "manually" check if its timers have expired; this is not done automatically.
A timer is declared as a struct
timer
and all access to the timer is made by a pointer to the declared timer.
- Note:
- The timer library uses the Clock library to measure time. Intervals should be specified in the format used by the clock library.
Function Documentation
int uip_timer_expired | ( | struct uip_timer * | t ) |
Check if a timer has expired.
This function tests if a timer has expired and returns true or false depending on its status.
- Parameters:
-
t A pointer to the timer
- Returns:
- Non-zero if the timer has expired, zero otherwise.
Definition at line 118 of file uip_timer.c.
void uip_timer_reset | ( | struct uip_timer * | t ) |
Reset the timer with the same interval.
This function resets the timer with the same interval that was given to the timer_set() function. The start point of the interval is the exact time that the timer last expired. Therefore, this function will cause the timer to be stable over time, unlike the timer_rester() function.
- Parameters:
-
t A pointer to the timer.
- See also:
- timer_restart()
Definition at line 81 of file uip_timer.c.
void uip_timer_restart | ( | struct uip_timer * | t ) |
Restart the timer from the current point in time.
This function restarts a timer with the same interval that was given to the timer_set() function. The timer will start at the current time.
- Note:
- A periodic timer will drift if this function is used to reset it. For preioric timers, use the timer_reset() function instead.
- Parameters:
-
t A pointer to the timer.
- See also:
- timer_reset()
Definition at line 101 of file uip_timer.c.
void uip_timer_set | ( | struct uip_timer * | t, |
clock_time_t | interval | ||
) |
Set a timer.
This function is used to set a timer for a time sometime in the future. The function timer_expired() will evaluate to true after the timer has expired.
- Parameters:
-
t A pointer to the timer interval The interval before the timer expires.
Definition at line 61 of file uip_timer.c.
Generated on Tue Jul 12 2022 18:10:58 by
