29 lines
458 B
C++
29 lines
458 B
C++
![]() |
#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);
|
||
|
}
|