root / trunk / code / projects / libdragonfly / time.h @ 1120
History | View | Annotate | Download (2.45 KB)
1 | 8 | bcoltin | /**
|
---|---|---|---|
2 | 241 | bcoltin | * Copyright (c) 2007 Colony Project
|
3 | *
|
||
4 | * Permission is hereby granted, free of charge, to any person
|
||
5 | * obtaining a copy of this software and associated documentation
|
||
6 | * files (the "Software"), to deal in the Software without
|
||
7 | * restriction, including without limitation the rights to use,
|
||
8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
9 | * copies of the Software, and to permit persons to whom the
|
||
10 | * Software is furnished to do so, subject to the following
|
||
11 | * conditions:
|
||
12 | *
|
||
13 | * The above copyright notice and this permission notice shall be
|
||
14 | * included in all copies or substantial portions of the Software.
|
||
15 | *
|
||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||
18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||
19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||
20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||
21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||
23 | * OTHER DEALINGS IN THE SOFTWARE.
|
||
24 | **/
|
||
25 | |||
26 | |||
27 | /**
|
||
28 | 8 | bcoltin | * @file time.h
|
29 | * @brief Contains time-related functions and definitions
|
||
30 | *
|
||
31 | * Contains functions and definitions for dealing with time,
|
||
32 | * namely delay_ms and the realtime clock.
|
||
33 | *
|
||
34 | * @author Colony Project, CMU Robotics Club
|
||
35 | **/
|
||
36 | |||
37 | #ifndef _TIME_H_
|
||
38 | #define _TIME_H_
|
||
39 | |||
40 | /* Predefined times for prescale_opt in time.c.
|
||
41 | 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
|
||
42 | to know how many 16ths of a second are in the time you want. (Time_desired * 16 = prescaler_opt)
|
||
43 | */
|
||
44 | /**
|
||
45 | * @addtogroup time
|
||
46 | * @{
|
||
47 | **/
|
||
48 | /** @brief A sixteenth of a second **/
|
||
49 | #define SIXTEENTH_SECOND 1 |
||
50 | /** @brief An eighth of a second **/
|
||
51 | #define EIGTH_SECOND 2 |
||
52 | /** @brief A quarter of a second **/
|
||
53 | #define QUARTER_SECOND 4 |
||
54 | /** @brief Half of a second **/
|
||
55 | #define HALF_SECOND 8 |
||
56 | /** @brief One second **/
|
||
57 | #define SECOND 16 |
||
58 | /** @brief Two seconds **/
|
||
59 | #define TWO_SECOND 32 |
||
60 | /** @brief Four seconds **/
|
||
61 | #define FOUR_SECOND 64 |
||
62 | |||
63 | /** @brief Delay execution for the specified time **/
|
||
64 | void delay_ms(int ms) ; |
||
65 | /** @brief Enable the realtime clock **/
|
||
66 | void rtc_init(int prescale_opt, void (*rtc_func)(void)); |
||
67 | /** @brief Reset the counter of the realtime clock **/
|
||
68 | void rtc_reset(void); |
||
69 | /** @brief Get the value of the realtime clock. **/
|
||
70 | int rtc_get(void); |
||
71 | |||
72 | /** @} **/
|
||
73 | |||
74 | #endif
|