mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
197af35de0
* start ledclone * led cloning: clone scan areas from original led main: show exceptions, better exit * tune json schema for new option. somwe cleanup * fix warnings and bug for framebuffer selection. thx to clang brought by new osx buikld on travis * make ledclone feature work flawlessly for effects too. Effect sees the ledstring without cloned leds. cloned leds will be inserted just before sending to leddevice additional: remove warnings and fix code style * fix warning
62 lines
1.3 KiB
C++
62 lines
1.3 KiB
C++
|
|
#pragma once
|
|
|
|
// STL includes
|
|
#include <cstdio>
|
|
|
|
// jsoncpp includes
|
|
#include <json/json.h>
|
|
|
|
// Hyperion-Leddevice includes
|
|
#include <leddevice/LedDevice.h>
|
|
|
|
class LedDevicePiBlaster : public LedDevice
|
|
{
|
|
public:
|
|
///
|
|
/// Constructs the PiBlaster device which writes to the indicated device and for the assigned
|
|
/// channels
|
|
/// @param deviceName The name of the output device
|
|
/// @param gpioMapping The RGB-Channel assignment json object
|
|
///
|
|
LedDevicePiBlaster(const std::string & deviceName, const Json::Value & gpioMapping);
|
|
|
|
virtual ~LedDevicePiBlaster();
|
|
|
|
///
|
|
/// 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();
|
|
|
|
///
|
|
/// 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);
|
|
|
|
///
|
|
/// Switches off the leds
|
|
///
|
|
/// @return Zero on success else negative
|
|
///
|
|
int switchOff();
|
|
|
|
private:
|
|
|
|
/// The name of the output device (very likely '/dev/pi-blaster')
|
|
const std::string _deviceName;
|
|
|
|
int _gpio_to_led[64];
|
|
char _gpio_to_color[64];
|
|
|
|
/// File-Pointer to the PiBlaster device
|
|
FILE * _fid;
|
|
|
|
};
|