mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	Merge pull request #514 from penfold42/master
add configuratble latch time for ws2801 Former-commit-id: cd226d63ebf4d158ce72cb88d49887d8e19a185c
This commit is contained in:
		@@ -129,8 +129,9 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
 | 
			
		||||
	{
 | 
			
		||||
		const std::string output = deviceConfig["output"].asString();
 | 
			
		||||
		const unsigned rate      = deviceConfig["rate"].asInt();
 | 
			
		||||
		const unsigned latchtime      = deviceConfig.get("latchtime",500000).asInt();
 | 
			
		||||
 | 
			
		||||
		LedDeviceWs2801* deviceWs2801 = new LedDeviceWs2801(output, rate);
 | 
			
		||||
		LedDeviceWs2801* deviceWs2801 = new LedDeviceWs2801(output, rate, latchtime);
 | 
			
		||||
		deviceWs2801->open();
 | 
			
		||||
 | 
			
		||||
		device = deviceWs2801;
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,13 @@ LedDeviceWs2801::LedDeviceWs2801(const std::string& outputDevice, const unsigned
 | 
			
		||||
	// empty
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
LedDeviceWs2801::LedDeviceWs2801(const std::string& outputDevice, const unsigned baudrate, const unsigned latchTime) :
 | 
			
		||||
	LedSpiDevice(outputDevice, baudrate, latchTime),
 | 
			
		||||
	mLedCount(0)
 | 
			
		||||
{
 | 
			
		||||
	// empty
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int LedDeviceWs2801::write(const std::vector<ColorRgb> &ledValues)
 | 
			
		||||
{
 | 
			
		||||
	mLedCount = ledValues.size();
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,10 @@ public:
 | 
			
		||||
	LedDeviceWs2801(const std::string& outputDevice,
 | 
			
		||||
					const unsigned baudrate);
 | 
			
		||||
 | 
			
		||||
	LedDeviceWs2801(const std::string& outputDevice,
 | 
			
		||||
					const unsigned baudrate,
 | 
			
		||||
					const unsigned latchTime);
 | 
			
		||||
 | 
			
		||||
	///
 | 
			
		||||
	/// Writes the led color values to the led-device
 | 
			
		||||
	///
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user