// STL includes #include #include #include #include // Linux includes #include #include // hyperion local includes #include "LedDeviceAPA102.h" LedDeviceAPA102::LedDeviceAPA102(const std::string& outputDevice, const unsigned baudrate) : LedSpiDevice(outputDevice, baudrate, 500000), _ledBuffer(0) { // empty } int LedDeviceAPA102::write(const std::vector &ledValues) { const unsigned int startFrameSize = 4; const unsigned int endFrameSize = std::max(((ledValues.size() + 15) / 16), 4); const unsigned int mLedCount = (ledValues.size() * 4) + startFrameSize + endFrameSize; if(_ledBuffer.size() != mLedCount){ _ledBuffer.resize(mLedCount, 0xFF); } for (unsigned iLed=0; iLed(_ledBuffer.size(), ColorRgb{0,0,0})); }