mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
d6a34edfb2
* add general switchOff * refactoring of leddevices regarding ledcount and switchoff * remove obsolete includes
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
#pragma once
|
|
|
|
// Hyperion-Leddevice includes
|
|
#include <leddevice/LedDevice.h>
|
|
|
|
class LedDevicePiBlaster : public LedDevice
|
|
{
|
|
public:
|
|
///
|
|
/// Constructs specific LedDevice
|
|
///
|
|
/// @param deviceConfig json device config
|
|
///
|
|
LedDevicePiBlaster(const Json::Value &deviceConfig);
|
|
|
|
virtual ~LedDevicePiBlaster();
|
|
|
|
///
|
|
/// Sets configuration
|
|
///
|
|
/// @param deviceConfig the json device config
|
|
/// @return true if success
|
|
bool setConfig(const Json::Value &deviceConfig);
|
|
|
|
/// constructs leddevice
|
|
static LedDevice* construct(const Json::Value &deviceConfig);
|
|
|
|
///
|
|
/// Attempts to open the piblaster-device. This will only succeed if the device is not yet open
|
|
/// and the device is available.
|
|
///
|
|
/// @return Zero on succes else negative
|
|
///
|
|
int open();
|
|
|
|
private:
|
|
///
|
|
/// Writes the colors to the PiBlaster device
|
|
///
|
|
/// @param ledValues The color value for each led
|
|
///
|
|
/// @return Zero on success else negative
|
|
///
|
|
int write(const std::vector<ColorRgb> &ledValues);
|
|
|
|
/// The name of the output device (very likely '/dev/pi-blaster')
|
|
std::string _deviceName;
|
|
|
|
int _gpio_to_led[64];
|
|
char _gpio_to_color[64];
|
|
|
|
/// File-Pointer to the PiBlaster device
|
|
FILE * _fid;
|
|
|
|
};
|