Header file for timer functionality.
More...
#include "types.h"
#include <sys/time.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <wiringPi.h>
Go to the source code of this file.
|
int | OSWait (int n) |
| Waits for 1 ms. More...
|
|
Timer | OSAttachTimer (int scale, void(*fct)(void)) |
| adds a function to a 1kHz/scale timer, ie. executes every 1ms*scale usage: OSAttachTimer(<scale>, &<function>); More...
|
|
int | OSDetachTimer (Timer handle) |
| removes the Timer from the list More...
|
|
int | OSSetTime (int hrs, int mins, int secs) |
| sets the system time More...
|
|
int | OSGetTime (int *hrs, int *mins, int *secs, int *ticks) |
| Get system time (ticks in 1/100 sec) More...
|
|
int | OSShowTime (void) |
| prints the time on the command line More...
|
|
int | OSGetCount (void) |
| gives you the count in 1/100 sec since the system start More...
|
|
Header file for timer functionality.
- Author
- Rhys Kessey
Timer OSAttachTimer |
( |
int |
scale, |
|
|
void(*)(void) |
fct |
|
) |
| |
adds a function to a 1kHz/scale timer, ie. executes every 1ms*scale usage: OSAttachTimer(<scale>, &<function>);
- Parameters
-
scale | the rate to run the function |
fct | the function to run, note must return void and have no arguments |
- Returns
- the Timer struct for the timer
int OSDetachTimer |
( |
Timer |
handle | ) |
|
removes the Timer from the list
- Parameters
-
handle | the timer to remove |
- Returns
- 0 always
gives you the count in 1/100 sec since the system start
- Returns
- the count
int OSGetTime |
( |
int * |
hrs, |
|
|
int * |
mins, |
|
|
int * |
secs, |
|
|
int * |
ticks |
|
) |
| |
Get system time (ticks in 1/100 sec)
- Parameters
-
hrs | the pointer to the hours integer |
mins | the pointer to the mins integer |
secs | the pointer to the secs integer |
ticks | the pointer to the ticks integer |
- Returns
- 0 always
int OSSetTime |
( |
int |
hrs, |
|
|
int |
mins, |
|
|
int |
secs |
|
) |
| |
sets the system time
- Parameters
-
hrs | the hours |
mins | the mins |
secs | the secs |
- Returns
- 0 always
prints the time on the command line
- Returns
- 0 always
Waits for 1 ms.
- Parameters
-
n | the number of ms to wait for |
- Returns
- 0 always