summaryrefslogtreecommitdiffstats
path: root/Tcs230.cpp
blob: 796bcb38ada97cd51a8b9841ebd786f33d8915a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "Tcs230.h"
#include "avr.h"


Tcs230::Tcs230()
{
	enabled = false;
	color = Red;
	scaling = Off;
}

void Tcs230::setEnabled(bool enabled) {
	this->enabled = enabled;
	
	PORTC = (PORTC&~0x40)|(enabled?0x40:0);
}

void Tcs230::setColor(Tcs230Colors color) {
	this->color = color;
	
	PORTC = (PORTC&~0x0C)|((color<<2)&0x0C);
}

void Tcs230::setScaling(Tcs230Scalings scaling) {
	this->scaling = scaling;
	
	PORTC = (PORTC&~0x30)|((scaling<<4)&0x30);
}