hyperion.ng/libsrc/leddevice/LedDeviceWs2812b.h
T. van der Zwan 01b5dcdd5c Added Ws2812b specific device
Former-commit-id: 675c8f578de42d12e25162065c0d0381ad0e08f6
2013-12-23 21:58:54 +00:00

35 lines
571 B
C++

#pragma once
// Hyperion leddevice includes
#include "LedRs232Device.h"
class LedDeviceWs2812b : public LedRs232Device
{
public:
LedDeviceWs2812b();
virtual int write(const std::vector<ColorRgb> & ledValues);
virtual int switchOff();
private:
struct ByteSignal
{
uint8_t bit_12;
uint8_t bit_34;
uint8_t bit_56;
uint8_t bit_78;
};
std::vector<ByteSignal> _byte2signalTable;
void fillTable();
ByteSignal byte2Signal(const uint8_t byte) const;
uint8_t bits2Signal(const bool bit1, const bool bit2) const;
std::vector<ByteSignal> _ledBuffer;
};