Project

General

Profile

Statistics
| Revision:

root / branches / library_refactor / projects / libdragonfly / lights.h @ 1131

History | View | Annotate | Download (3.32 KB)

1
// FIXME remove
2
typedef unsigned char uint8_t;
3

    
4

    
5
/**
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
/**
46
 * @addtogroup orbs
47
 * @{
48
 **/
49

    
50
// ORB Colors
51
/** @brief Red **/
52
#define RED       0xE0
53
/** @brief Orange **/
54
#define ORANGE    0xE4
55
/** @brief Yellow **/
56
#define YELLOW    0xE8
57
/** @brief Lime **/
58
#define LIME      0x68
59
/** @brief Green **/
60
#define GREEN     0x1C
61
/** @brief Cyan **/
62
#define CYAN      0x1F
63
/** @brief Blue **/
64
#define BLUE      0x03
65
/** @brief Pink **/
66
#define PINK      0xA6 
67
/** @brief Purple **/
68
#define PURPLE    0x41
69
/** @brief Magenta **/
70
#define MAGENTA   0xE3
71
/** @brief White **/
72
#define WHITE     0xFE
73
/** @brief Turn the orb off **/
74
#define ORB_OFF   0x00
75

    
76

    
77
// ***** Initialization *****
78

    
79
/** @brief Enables the orbs **/
80
void orb_init(void);
81

    
82

    
83

    
84
// ***** Setting RGB colors *****
85

    
86
/** @brief Set both orbs to a specified color **/
87
void orb_set(uint8_t red, uint8_t green, uint8_t blue);
88

    
89
/** @brief Set orb1 to a specified color **/
90
void orb1_set(uint8_t red_led, uint8_t green_led, uint8_t blue_led); 
91

    
92
/** @brief Set orb2 to a specified color **/
93
void orb2_set(uint8_t red_led, uint8_t green_led, uint8_t blue_led);
94

    
95
void orbs_set (uint8_t red1, uint8_t green1, uint8_t blue1, uint8_t red2, uint8_t green2, uint8_t blue2);
96

    
97

    
98
// ***** Settings predefined colors *****
99

    
100
/** @brief Set both orbs to a specified color **/
101
void orb_set_color(uint8_t col);
102

    
103
/** @brief Set orb1 to a specified color **/
104
void orb1_set_color(uint8_t col);
105

    
106
/** @brief Set orb2 to a specified color **/
107
void orb2_set_color(uint8_t col);
108

    
109
void orbs_set_color(uint8_t col1, uint8_t col2);
110

    
111

    
112
// ***** Mode setting *****
113

    
114
typedef uint8_t orb_mode_t;
115
#define orb_mode_pwm 0
116
#define orb_mode_binary 1
117

    
118
void orb_set_mode (orb_mode_t mode);
119

    
120

    
121
// ***** Initialization *****
122

    
123
void orb_init_binary (void);
124
void orb_init_pwm (void);
125
void orb_init (void);
126

    
127
/** @} **/ //end addtogroup
128

    
129

    
130
#endif
131