From 79dda5e8402219c9e78c9711bb59e1a29b428944 Mon Sep 17 00:00:00 2001 From: wisc Date: Sun, 7 Feb 2016 17:40:24 +0100 Subject: [PATCH] Update LedDeviceAPA102.cpp by pcaffardi Former-commit-id: e7efe8917fc10ceb860e44bbb37442cffa3512db --- libsrc/leddevice/LedDeviceAPA102.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libsrc/leddevice/LedDeviceAPA102.cpp b/libsrc/leddevice/LedDeviceAPA102.cpp index fb016229..17bec4fc 100644 --- a/libsrc/leddevice/LedDeviceAPA102.cpp +++ b/libsrc/leddevice/LedDeviceAPA102.cpp @@ -2,7 +2,6 @@ #include #include #include -#include // Linux includes #include @@ -32,15 +31,15 @@ LedDeviceAPA102::LedDeviceAPA102(const std::string& outputDevice, const unsigned int LedDeviceAPA102::write(const std::vector &ledValues) { const unsigned int startFrameSize = APA102_START_FRAME_BYTES; - const unsigned int ledsCount = ledValues.size() ; - const unsigned int ledsSize = ledsCount * APA102_LED_BYTES ; - const unsigned int endFrameBits = APA102_END_FRAME_BITS(ledsCount) ; - const unsigned int endFrameSize = APA102_END_FRAME_BYTES(ledsCount) ; - const unsigned int transferSize = startFrameSize + ledsSize + endFrameSize ; + const unsigned int ledsCount = ledValues.size() ; + const unsigned int ledsSize = ledsCount * APA102_LED_BYTES ; + const unsigned int endFrameBits = APA102_END_FRAME_BITS(ledsCount) ; + const unsigned int endFrameSize = APA102_END_FRAME_BYTES(ledsCount) ; + const unsigned int transferSize = startFrameSize + ledsSize + endFrameSize ; if(_ledBuffer.size() != transferSize){ _ledBuffer.resize(transferSize, 0x00); - } + } unsigned idx = 0, i; for (i=0; i &ledValues) _ledBuffer[idx++] = rgb.blue; } for(i=0; i &ledValues) int LedDeviceAPA102::switchOff() { return write(std::vector(_ledBuffer.size(), ColorRgb{0,0,0})); -} +}