Project

General

Profile

Statistics
| Revision:

root / branches / wireless / code / behaviors / Wireless_Speed_test / time.h @ 1560

History | View | Annotate | Download (2.45 KB)

1
/**
2
 * 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
 * @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

    
41
/*        Predefined times for prescale_opt in time.c.
42
        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
43
        to know how many 16ths of a second are in the time you want. (Time_desired * 16 = prescaler_opt)
44
*/
45
/**
46
 * @addtogroup time
47
 * @{
48
 **/
49
/** @brief A sixteenth of a second **/
50
#define SIXTEENTH_SECOND 1
51
/** @brief An eighth of a second **/
52
#define EIGTH_SECOND 2
53
/** @brief A quarter of a second **/
54
#define QUARTER_SECOND 4
55
/** @brief Half of a second **/
56
#define HALF_SECOND        8
57
/** @brief One second **/
58
#define SECOND 16
59
/** @brief Two seconds **/
60
#define TWO_SECOND 32
61
/** @brief Four seconds **/
62
#define FOUR_SECOND 64
63

    
64
/** @brief Delay execution for the specified time **/
65
void delay_ms(int ms) ;
66
/** @brief Enable the realtime clock **/
67
int rtc_init(int prescale_opt, void (*rtc_func)(void));
68
/** @brief Reset the counter of the realtime clock **/
69
void rtc_reset(void);
70
/** @brief Get the value of the realtime clock. **/
71
int rtc_get(void);
72

    
73
/** @} **/
74

    
75
#endif
76