root / branches / autonomous_recharging / code / projects / colonet / utilities / robot_wireless_relay / time.h @ 1390
History | View | Annotate | Download (1.22 KB)
1 | 13 | emarinel | /*
|
---|---|---|---|
2 | time.h
|
||
3 | */
|
||
4 | |||
5 | #ifndef _TIME_H_
|
||
6 | #define _TIME_H_
|
||
7 | |||
8 | #define TIMER_OFF 0x00 |
||
9 | #define PRESCALE_NONE 0x01 |
||
10 | #define PRESCALE_DIV_8 0x02 |
||
11 | #define PRESCALE_DIV_32 0x03 |
||
12 | #define PRESCALE_DIV_64 0x04 |
||
13 | #define PRESCALE_DIV_128 0x05 |
||
14 | #define PRESCALE_DIV_256 0x06 |
||
15 | #define PRESCALE_DIV_1024 0x07 |
||
16 | |||
17 | /*
|
||
18 | delay_ms(int ms)
|
||
19 | pause_ms(int ms)
|
||
20 | sleep_ms(int ms)
|
||
21 | pause(int ms)
|
||
22 | sleep(int ms)
|
||
23 | |||
24 | all have the same behavior
|
||
25 | pauses the calling process for the specified
|
||
26 | amount of time in milliseconds
|
||
27 | */
|
||
28 | void delay_ms(int ms) ; |
||
29 | void pause_ms(int ms); |
||
30 | void pause(int ms); |
||
31 | void sleep_ms(int ms); |
||
32 | void sleep(int ms); |
||
33 | |||
34 | /*
|
||
35 | void rtc_init(void)
|
||
36 | call this function to initialize the real time clock
|
||
37 | real time clock requires global interrupts to be enabled
|
||
38 | */
|
||
39 | void rtc_init(int prescale_opt, unsigned char ocr_val, void (*rtc_func)(void)); |
||
40 | |||
41 | /*
|
||
42 | void rtc_reset(void)
|
||
43 | use this to reset the real time value
|
||
44 | rtc_init() should be called beforehand
|
||
45 | */
|
||
46 | void rtc_reset(void); |
||
47 | |||
48 | /*
|
||
49 | int rtc(void)
|
||
50 | returns the current value of the real time clock (in seconds)
|
||
51 | rtc_init() should be called beforehand
|
||
52 | |||
53 | the returned amount is the number of seconds that have past since the
|
||
54 | last call to rtc_init() or rtc_reset()
|
||
55 | */
|
||
56 | int rtc(void); |
||
57 | |||
58 | #endif |