Project

General

Profile

Revision 729

Fixed the issue with green and blue channels coming faintly on at startup. BOM led issues debugged (the JTAG fuse was incorrectly set). lbom now in working order.

View differences:

orb.c
34 34

  
35 35
#include <avr/io.h>
36 36
#include "orb.h"
37
#include "serial.h"
37 38

  
38 39
/**
39 40
 * @defgroup orbs Orbs
......
48 49
 * Initializes the PWM for Orb control. This must be called before 
49 50
 * the orbs are used for them to function.
50 51
 **/
51
int orb_init (void)
52
void orb_init (void)
52 53
{
53 54
	/*data direction registers, blue, green (bit 6) and red (bit 4)*/
54 55
	DDRB |= _BV(DDB4);
......
75 76
	ICR1 = 0x9C40;
76 77
	OCR1B = 0;
77 78
   
78
	return 0;
79
	set_orb(0, 0, 0);
79 80
}
80 81

  
81 82
/**
......
89 90
 * @see orb_init
90 91
 **/
91 92
 
92
int set_orb(int red, int green, int blue){
93
void set_orb(int red, int green, int blue){
93 94
	/*blue is here. it goes on timer 0*/
94 95
	if(blue==0){
95 96
		DDRB &= ~(_BV(DDB4));
......
112 113
	
113 114
	/*red is here. it goes on timer 1*/
114 115
	red = red%256;
115
	red *= 0x9C40;
116
	red = (int)(red/256); 
116
	red = red*157;
117 117
	OCR1B = red;
118

  
119
	return 0;
120 118
}
121 119

  
122 120
/**
......
128 126
 * @see orb_init
129 127
 **/
130 128
 
131
 int set_color(long color){
129
 void set_color(long color){
132 130
	int red = (color>>16)&BYTEMASK;
133 131
	int green = (color>>8)&BYTEMASK;
134 132
	int blue = color&BYTEMASK;
135
	return set_orb(red, green, blue);
133
	set_orb(red, green, blue);
136 134
 }
137 135

  
138 136
/** @} **/ //end group

Also available in: Unified diff