Project

General

Profile

Statistics
| Revision:

root / branches / encoders / code / lib / include / libdragonfly / time.h @ 184

History | View | Annotate | Download (1.51 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
/*Maximum # of functions*/
15
#define MAX_FUNCTIONS 10
16

    
17

    
18
/*        Predefined times for prescale_opt in time.c.
19
        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
20
        to know how many 16ths of a second are in the time you want. (Time_desired * 16 = prescaler_opt)
21
*/
22
/**
23
 * @addtogroup time
24
 * @{
25
 **/
26
/** @brief A sixteenth of a second **/
27
#define SIXTEENTH_SECOND 1
28
/** @brief An eighth of a second **/
29
#define EIGTH_SECOND 2
30
/** @brief A quarter of a second **/
31
#define QUARTER_SECOND 4
32
/** @brief Half of a second **/
33
#define HALF_SECOND        8
34
/** @brief One second **/
35
#define SECOND 16
36
/** @brief Two seconds **/
37
#define TWO_SECOND 32
38
/** @brief Four seconds **/
39
#define FOUR_SECOND 64
40

    
41
/** @brief Delay execution for the specified time **/
42
void delay_ms(int ms) ;
43
/** @brief Enable the realtime clock **/
44
int rtc_multi_init(int* prescale_opt, void (*rtc_fun[])(void), int argc);
45
/** @brief Reset the counter of the realtime clock **/
46
void rtc_reset(void);
47
/** @brief Get the value of the realtime clock. **/
48
int rtc_get(void);
49

    
50
int add_function(int prescale_opt, void *rtc_f (void));
51

    
52
int rtc_init(int prescale_opt, void *rtc_func(void));
53

    
54
/** @} **/
55

    
56
#endif
57