root / trunk / code / projects / libdragonfly / time.h @ 138
History | View | Annotate | Download (1.32 KB)
1 |
/**
|
---|---|
2 |
* @file time.h
|
3 |
* @brief Contains time-related functions and definitions
|
4 |
*
|
5 |
* Contains functions and definitions for dealing with time,
|
6 |
* namely delay_ms and the realtime clock.
|
7 |
*
|
8 |
* @author Colony Project, CMU Robotics Club
|
9 |
**/
|
10 |
|
11 |
#ifndef _TIME_H_
|
12 |
#define _TIME_H_
|
13 |
|
14 |
/* Predefined times for prescale_opt in time.c.
|
15 |
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
|
16 |
to know how many 16ths of a second are in the time you want. (Time_desired * 16 = prescaler_opt)
|
17 |
*/
|
18 |
/**
|
19 |
* @addtogroup time
|
20 |
* @{
|
21 |
**/
|
22 |
/** @brief A sixteenth of a second **/
|
23 |
#define SIXTEENTH_SECOND 1 |
24 |
/** @brief An eighth of a second **/
|
25 |
#define EIGTH_SECOND 2 |
26 |
/** @brief A quarter of a second **/
|
27 |
#define QUARTER_SECOND 4 |
28 |
/** @brief Half of a second **/
|
29 |
#define HALF_SECOND 8 |
30 |
/** @brief One second **/
|
31 |
#define SECOND 16 |
32 |
/** @brief Two seconds **/
|
33 |
#define TWO_SECOND 32 |
34 |
/** @brief Four seconds **/
|
35 |
#define FOUR_SECOND 64 |
36 |
|
37 |
/** @brief Delay execution for the specified time **/
|
38 |
void delay_ms(int ms) ; |
39 |
/** @brief Enable the realtime clock **/
|
40 |
void rtc_init(int prescale_opt, void (*rtc_func)(void)); |
41 |
/** @brief Reset the counter of the realtime clock **/
|
42 |
void rtc_reset(void); |
43 |
/** @brief Get the value of the realtime clock. **/
|
44 |
int rtc_get(void); |
45 |
|
46 |
/** @} **/
|
47 |
|
48 |
#endif
|
49 |
|