diff options
Diffstat (limited to 'Tcs230.cpp')
-rw-r--r-- | Tcs230.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Tcs230.cpp b/Tcs230.cpp new file mode 100644 index 0000000..796bcb3 --- /dev/null +++ b/Tcs230.cpp @@ -0,0 +1,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); +} |