Project

General

Profile

Statistics
| Revision:

root / trunk / code / lib / include / libdragonfly / lights.h @ 1142

History | View | Annotate | Download (4.03 KB)

1 1142 deffi
// FIXME remove
2
typedef unsigned char uint8_t;
3
4
5 241 bcoltin
/**
6
 * Copyright (c) 2007 Colony Project
7
 *
8
 * Permission is hereby granted, free of charge, to any person
9
 * obtaining a copy of this software and associated documentation
10
 * files (the "Software"), to deal in the Software without
11
 * restriction, including without limitation the rights to use,
12
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
13
 * copies of the Software, and to permit persons to whom the
14
 * Software is furnished to do so, subject to the following
15
 * conditions:
16
 *
17
 * The above copyright notice and this permission notice shall be
18
 * included in all copies or substantial portions of the Software.
19
 *
20
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27
 * OTHER DEALINGS IN THE SOFTWARE.
28
 **/
29
30
31
/**
32
 * @file lights.h
33
 * @brief Contains declarations for managing the orbs.
34
 *
35
 * Contains declarations for using the orbs and PWM.
36
 *
37
 * @author Colony Project, CMU Robotics Club
38
 * Based on Firefly Library, by Tom Lauwers and Steven Shamlian
39
 **/
40
41
#ifndef _LIGHTS_H_
42
#define _LIGHTS_H_
43
44
/**
45
 * @addtogroup orbs
46
 * @{
47
 **/
48
49 1142 deffi
// ***** Predefined colors *****
50 241 bcoltin
/** @brief Red **/
51
#define RED       0xE0
52
/** @brief Orange **/
53
#define ORANGE    0xE4
54
/** @brief Yellow **/
55
#define YELLOW    0xE8
56
/** @brief Lime **/
57
#define LIME      0x68
58
/** @brief Green **/
59
#define GREEN     0x1C
60
/** @brief Cyan **/
61
#define CYAN      0x1F
62
/** @brief Blue **/
63
#define BLUE      0x03
64
/** @brief Pink **/
65
#define PINK      0xA6
66
/** @brief Purple **/
67
#define PURPLE    0x41
68
/** @brief Magenta **/
69
#define MAGENTA   0xE3
70
/** @brief White **/
71
#define WHITE     0xFE
72 1142 deffi
/** @brief Turn the orb off **/
73
#define ORB_OFF   0x00
74 241 bcoltin
75 1142 deffi
76
77
// ***** Initialization *****
78
79
/** @brief Enables the orbs in default mode **/
80 241 bcoltin
void orb_init(void);
81 1142 deffi
82
/** @brief Enables the orbs in binary mode **/
83
void orb_init_binary (void);
84
85
/** @brief Enables the orbs in PWM mode **/
86
void orb_init_pwm (void);
87
88
89
90
// ***** Mode setting *****
91
92
/** Specification of the orb mode **/
93
typedef uint8_t orb_mode_t;
94
95
/** @brief PWM mode **/
96
#define orb_mode_pwm 0
97
98
/** @brief Binary mode **/
99
#define orb_mode_binary 1
100
101
102
/** @brief Switches the orbs to the specified mode **/
103
void orb_set_mode (orb_mode_t mode);
104
105
/** @brief Disables the orb timer, but does not change the mode **/
106
void orb_disable_timer (void);
107
108
/** @brief Enables the orb timer, but does not change the mode **/
109
void orb_enable_timer (void);
110
111
112
113
// ***** Setting RGB colors *****
114
115
/** @brief set the specified orb to a specified color **/
116
void orb_n_set (uint8_t num, uint8_t red, uint8_t green, uint8_t blue);
117
118 241 bcoltin
/** @brief Set both orbs to a specified color **/
119 1142 deffi
void orb_set(uint8_t red, uint8_t green, uint8_t blue);
120
121 241 bcoltin
/** @brief Set orb1 to a specified color **/
122 1142 deffi
void orb1_set(uint8_t red_led, uint8_t green_led, uint8_t blue_led);
123
124 241 bcoltin
/** @brief Set orb2 to a specified color **/
125 1142 deffi
void orb2_set(uint8_t red_led, uint8_t green_led, uint8_t blue_led);
126 241 bcoltin
127 1142 deffi
void orbs_set (uint8_t red1, uint8_t green1, uint8_t blue1, uint8_t red2, uint8_t green2, uint8_t blue2);
128
129
130
131
// ***** Settings predefined colors *****
132
133
/** @brief set the specified orb to the specified color **/
134
void orb_n_set_color(uint8_t num, uint8_t col);
135
136 241 bcoltin
/** @brief Set orb1 to a specified color **/
137 1142 deffi
void orb1_set_color(uint8_t col);
138
139 241 bcoltin
/** @brief Set orb2 to a specified color **/
140 1142 deffi
void orb2_set_color(uint8_t col);
141 241 bcoltin
142 1142 deffi
/** @brief set the orbs to specified colors **/
143
void orbs_set_color(uint8_t col1, uint8_t col2);
144 241 bcoltin
145 1142 deffi
/** @brief Set both orbs to a specified color **/
146
void orb_set_color(uint8_t col);
147
148
149
150 241 bcoltin
/** @} **/ //end addtogroup
151
152
#endif