mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	* 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;
 | 
						|
 | 
						|
};
 |