sys/timers.h
#include <sys/timers.h>
This header includes defines for the CE’s 3 hardware timers. It is discouraged from directly modifying the timers themseleves, and instead use the standard C clock() fuction. These functions provide direct maniplution of the hardware timers. Keep in mind that using them may cause the clock() and related functions to not work correctly. This header also includes functions such as sleep() and delay() which are based around clock()’s functionality and are always safe to use.
There are two possible timing (“clock”) sources: a 32768 Hz crystal with similar accuracy to the clock found in any smartphone or wristwatch, and the CPU’s main 48 MHz clock with likely much inferior accuracy.
API Documentation
CE hardware timers define file.
- Authors
Matt “MateoConLechuga” Waltz
Jacob “jacobly” Young
Typedefs
Functions
-
void delay(uint16_t msec)
Suspends execution of the calling thread for (at least)
msec
milliseconds.See also
See also
- Parameters
msec – [in] number of milliseconds
-
void msleep(uint16_t msec)
Suspends execution of the calling thread for (at least)
msec
milliseconds.See also
See also
- Parameters
msec – [in] number of milliseconds
-
unsigned int sleep(unsigned int seconds)
Sleeps until the number of real-time seconds specified in
seconds
have elapsed or until a signal arrives which is not ignored.See also
See also
Note
Currently, signals do not exist, so this will never be interrupted.
- Parameters
seconds – [in] number of seconds
- Returns
zero if the requested time has elapsed, or the number of seconds left to sleep, if the call was interrupted by a signal handler
-
void ticksleep(unsigned long ticks)
Suspends execution of the calling thread for (at least)
ticks
clock ticks.See also
CLOCKS_PER_SEC
See also
See also
- Parameters
ticks – [in] number of clock ticks
-
int usleep(useconds_t usec)
Suspends execution of the calling thread for (at least)
usec
microseconds.The sleep may be lengthened slightly by any system activity or by the time spent processing the call or by the granularity of system timers.
See also
See also
See also
Note
Currently, no errors are possible.
- Parameters
usec – [in] number of microseconds
- Returns
0 on success, or -1 on error, with
errno
set to indicate the error