root / branches / simulator / projects / libdragonfly / include / lights.h @ 891
History | View | Annotate | Download (4.98 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 lights.h
|
29 |
* @brief Contains declarations for managing the orbs.
|
30 |
*
|
31 |
* Contains declarations for using the orbs and PWM.
|
32 |
*
|
33 |
* @author Colony Project, CMU Robotics Club
|
34 |
* Based on Firefly Library, by Tom Lauwers and Steven Shamlian
|
35 |
**/
|
36 |
|
37 |
#ifndef _LIGHTS_H_
|
38 |
#define _LIGHTS_H_
|
39 |
|
40 |
|
41 |
/**
|
42 |
* @defgroup orbs Orbs
|
43 |
* @brief Functions for controlling the color of the orbs.
|
44 |
*
|
45 |
* Functions for controlling the color and lighting of the orbs.
|
46 |
*
|
47 |
* @{
|
48 |
**/
|
49 |
|
50 |
|
51 |
//ORB Colors
|
52 |
/** @brief Red **/
|
53 |
#define RED 0xE0 |
54 |
/** @brief Orange **/
|
55 |
#define ORANGE 0xE4 |
56 |
/** @brief Yellow **/
|
57 |
#define YELLOW 0xE8 |
58 |
/** @brief Lime **/
|
59 |
#define LIME 0x68 |
60 |
/** @brief Green **/
|
61 |
#define GREEN 0x1C |
62 |
/** @brief Cyan **/
|
63 |
#define CYAN 0x1F |
64 |
/** @brief Blue **/
|
65 |
#define BLUE 0x03 |
66 |
/** @brief Pink **/
|
67 |
#define PINK 0xA6 |
68 |
/** @brief Purple **/
|
69 |
#define PURPLE 0x41 |
70 |
/** @brief Magenta **/
|
71 |
#define MAGENTA 0xE3 |
72 |
/** @brief White **/
|
73 |
#define WHITE 0xFE |
74 |
/** @brief Turn the orb off (White) **/
|
75 |
#define ORB_OFF 0xFE //ORB_OFF->WHITE |
76 |
|
77 |
/**
|
78 |
* @brief Enables the orbs
|
79 |
*
|
80 |
* Initializes the PWM for Orb control. This must be called before
|
81 |
* the orbs are used for them to function.
|
82 |
**/
|
83 |
void orb_init(void); |
84 |
/**
|
85 |
* @brief Set both orbs to a specified color
|
86 |
*
|
87 |
* Set both orbs to the color specified. orb_init must
|
88 |
* be called before this function may be used.
|
89 |
*
|
90 |
* @param red_led the red component of the color
|
91 |
* @param green_led the green component of the color
|
92 |
* @param blue_led the blue component of the color
|
93 |
*
|
94 |
* @see orb_init
|
95 |
**/
|
96 |
void orb_set(unsigned char red_led, unsigned char green_led, |
97 |
unsigned char blue_led); |
98 |
/**
|
99 |
* @brief Set orb1 to a specified color
|
100 |
*
|
101 |
* Set orb1 to the color specified. orb_init must
|
102 |
* be called before this function may be used.
|
103 |
*
|
104 |
* @param red_led the red component of the color
|
105 |
* @param green_led the green component of the color
|
106 |
* @param blue_led the blue component of the color
|
107 |
*
|
108 |
* @see orb_init
|
109 |
**/
|
110 |
void orb1_set(unsigned char red_led, unsigned char green_led, |
111 |
unsigned char blue_led); |
112 |
/**
|
113 |
* @brief Set orb2 to a specified color.
|
114 |
*
|
115 |
* Set orb2 to the color specified. orb_init must
|
116 |
* be called before this function may be used.
|
117 |
*
|
118 |
* @param red_led the red component of the color
|
119 |
* @param green_led the green component of the color
|
120 |
* @param blue_led the blue component of the color
|
121 |
*
|
122 |
* @see orb_init
|
123 |
**/
|
124 |
void orb2_set(unsigned char red_led, unsigned char green_led, |
125 |
unsigned char blue_led); |
126 |
|
127 |
/**
|
128 |
* @brief Set both orbs to a specified color
|
129 |
*
|
130 |
* Set both orbs to the specified color. This function
|
131 |
* is intended to be used with the predefined
|
132 |
* colors. orb_init must be called before this
|
133 |
* function may be used.
|
134 |
*
|
135 |
* @param col the color to set the orbs to
|
136 |
*
|
137 |
* @see orb_init
|
138 |
**/
|
139 |
void orb_set_color(int col); |
140 |
/**
|
141 |
* @brief Set orb1 to a specified color
|
142 |
*
|
143 |
* Set orb1 to the specified color. This function
|
144 |
* is intended to be used with the predefined
|
145 |
* colors. orb_init must be called before this
|
146 |
* function may be used.
|
147 |
*
|
148 |
* @param col the color to set the orbs to
|
149 |
*
|
150 |
* @see orb_init
|
151 |
**/
|
152 |
void orb1_set_color(int col); |
153 |
/**
|
154 |
* @brief Set orb2 to a specified color
|
155 |
*
|
156 |
* Set orb2 to the specified color. This function
|
157 |
* is intended to be used with the predefined
|
158 |
* colors. orb_init must be called before this
|
159 |
* function may be used.
|
160 |
*
|
161 |
* @param col the color to set the orbs to
|
162 |
*
|
163 |
* @see orb_init
|
164 |
**/
|
165 |
void orb2_set_color(int col); |
166 |
|
167 |
/**
|
168 |
* @brief Disable the orbs
|
169 |
*
|
170 |
* Disables the orb color fading capabilities
|
171 |
* by disabling the timer1 interrupt.
|
172 |
*
|
173 |
* @see orb_init
|
174 |
**/
|
175 |
void orb_disable(void); |
176 |
/**
|
177 |
* @brief Enable the orbs
|
178 |
*
|
179 |
* Enables the orb's color fading capabilities.
|
180 |
*
|
181 |
* @see orb_init
|
182 |
**/
|
183 |
void orb_enable(void); |
184 |
|
185 |
/** @} **/ //end addtogroup |
186 |
|
187 |
#endif
|
188 |
|