forked from ForsakenNGS/PicoLED
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVirtualStrip.cpp
More file actions
38 lines (28 loc) · 845 Bytes
/
VirtualStrip.cpp
File metadata and controls
38 lines (28 loc) · 845 Bytes
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
29
30
31
32
33
34
35
36
37
38
#include "VirtualStrip.hpp"
namespace PicoLed {
VirtualStrip::VirtualStrip(shared_ptr<PicoLedTarget> target, uint start, uint end):
PicoLedTarget(*target), target(target), start(start), end(end)
{
this->numLeds = (start < end ? end - start : start - end);
}
VirtualStrip::~VirtualStrip() {
}
uint8_t VirtualStrip::getBrightness() {
return target->getBrightness();
}
void VirtualStrip::setBrightness(uint8_t brightness) {
target->setBrightness(brightness);
}
uint32_t VirtualStrip::getData(uint index) {
return target->getData( getRealIndex(index) );
}
void VirtualStrip::setData(uint index, uint32_t value) {
target->setData( getRealIndex(index), value );
}
void VirtualStrip::show() {
target->show();
}
uint VirtualStrip::getRealIndex(uint index) {
return (start < end ? start + index : start - index);
}
}