Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / colonet / utilities / dragonfly_wireless_relay / time.h @ 13

History | View | Annotate | Download (1.37 KB)

1
/*
2
time.h
3
*/
4

    
5
#ifndef _TIME_H_
6
#define _TIME_H_
7

    
8
/*        Predefined times for prescale_opt in time.c.
9
        To make you own, know that a pulse is 1/16th of a second. You cannot get less than this. To get more, you need
10
        to know how many 16ths of a second are in the time you want. (Time_desired * 16 = prescaler_opt)
11
*/
12
#define SIXTEENTH_SECOND 1
13
#define EIGTH_SECOND 2
14
#define QUARTER_SECOND 4
15
#define HALF_SECOND        8
16
#define SECOND 16
17
#define TWO_SECOND 32
18
#define FOUR_SECOND 64
19
/*
20
delay_ms(int ms)
21
pause_ms(int ms)
22
sleep_ms(int ms)
23
pause(int ms)
24
sleep(int ms)
25

26
all have the same behavior
27
pauses the calling process for the specified
28
amount of time in milliseconds
29
*/
30
void delay_ms(int ms) ;
31
void pause_ms(int ms);
32
void pause(int ms);
33
void sleep_ms(int ms);
34
void sleep(int ms);
35

    
36
/*
37
void rtc_init(void)
38
call this function to initialize the real time clock
39
real time clock requires global interrupts to be enabled
40
*/
41
void rtc_init(int prescale_opt, void (*rtc_func)(void));
42
/*
43
void rtc_reset(void)
44
use this to reset the real time value
45
rtc_init() should be called beforehand
46
*/
47
void rtc_reset(void);
48

    
49
/*
50
int rtc(void)
51
returns the current value of the real time clock (in seconds)
52
rtc_init() should be called beforehand
53

54
the returned amount is the number of seconds that have past since the
55
last call to rtc_init() or rtc_reset()
56
*/
57
int rtc(void);
58

    
59
#endif