mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
add files for P9813 support
Former-commit-id: 66a4d02bf0e2c7f85d2713a906461df11931cfff
This commit is contained in:
34
libsrc/leddevice/LedDeviceP9813.cpp
Normal file
34
libsrc/leddevice/LedDeviceP9813.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
// STL includes
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
// Linux includes
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
// hyperion local includes
|
||||
#include "LedDeviceP9813.h"
|
||||
|
||||
LedDeviceP9813::LedDeviceP9813(const std::string& outputDevice, const unsigned baudrate) :
|
||||
LedSpiDevice(outputDevice, baudrate, 0),
|
||||
mLedCount(0)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
int LedDeviceP9813::write(const std::vector<ColorRgb> &ledValues)
|
||||
{
|
||||
mLedCount = ledValues.size();
|
||||
|
||||
const unsigned dataLen = ledValues.size() * sizeof(ColorRgb);
|
||||
const uint8_t * dataPtr = reinterpret_cast<const uint8_t *>(ledValues.data());
|
||||
|
||||
return writeBytes(dataLen, dataPtr);
|
||||
}
|
||||
|
||||
int LedDeviceP9813::switchOff()
|
||||
{
|
||||
return write(std::vector<ColorRgb>(mLedCount, ColorRgb{0,0,0}));
|
||||
}
|
||||
Reference in New Issue
Block a user