hyperion.ng/libsrc/leddevice/LedDevicePiBlaster.h
redPanther 197af35de0 Clone single led color from other led (#157)
* 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
2016-08-08 00:17:00 +02:00

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;
};