Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / colonet / utilities / robot_slave / lights.h @ 13

History | View | Annotate | Download (2.02 KB)

1
/*
2
lights.h
3

4
Contains function prototypes, variables, and pins used by the Orbs and PWM
5

6
most of this is shamelessly copied from FWR's orb.h (Tom Lauwers and Steven Shamlian)
7

8
author: CMU Robotics Club, Colony Project
9

10
Change Log:
11
1.25.07 - KWoo
12
        Removed FF+ code. Cleaned up and commented all variables.
13

14
*/
15

    
16
#ifndef _LIGHTS_H_
17
#define _LIGHTS_H_
18

    
19
/***** Port and Pin Definitions ****/
20

    
21
//Orb Ports and Registers
22
#define ORB_PORT        PORTC
23
#define ORB_DDR                DDRC
24

    
25
//Orb Pins
26
#define ORB1_RED        0x00
27
#define ORB1_GREEN        0x01
28
#define ORB1_BLUE        0x02
29
#define ORB2_RED         0x04
30
#define ORB2_GREEN         0x05
31
#define ORB2_BLUE         0x06
32

    
33
//ORB Colors
34
#define RED       0xE0
35
#define ORANGE    0xE4
36
#define YELLOW    0xE8
37
#define LIME      0x68
38
#define GREEN     0x1C
39
#define CYAN      0x1F
40
#define BLUE      0x03
41
#define PINK      0xA6 
42
#define PURPLE    0x41
43
#define MAGENTA   0xE3
44
#define WHITE     0xFE
45
#define ORB_OFF   0x00
46

    
47

    
48

    
49
#include <avr/interrupt.h>
50

    
51

    
52
#define ORB_RESET 1025
53

    
54
#define ORBPORT PORTC
55

    
56
#define ORBDDR DDRC
57

    
58
#define ORBMASK 0x77
59

    
60

    
61

    
62
/**** Function Prototypes ****/
63
//Enables counter and PWM for use with the orb.
64
void orb_init(void);
65

    
66
//Sets both orbs to a specified color 
67
void orb_set(unsigned char red_led, unsigned char green_led, unsigned char blue_led);
68
//Sets Orb1 to the specified color
69
void orb1_set(unsigned char red_led, unsigned char green_led, unsigned char blue_led); 
70
//Sets Orb2 to the specified color
71
void orb2_set(unsigned char red_led, unsigned char green_led, unsigned char blue_led);
72

    
73
//Sets both orbs to the same color using a color name
74
void orb_set_color(int col);
75
//Sets orb1 to a color using a color name
76
void orb1_set_color(int col);
77
//Sets orb2 to a color using a color name
78
void orb2_set_color(int col);
79

    
80
//Turns off the PWM and thus the Orbs
81
void orb_disable(void);
82
//Turns on the PWM and thus the Orbs
83
void orb_enable(void);
84

    
85
//Runs through some colors
86
void orb_tester(void);
87
//Set just one channel
88
void orb_set_angle(int servo, int angle);
89

    
90
#endif