Add ws281x driver parameter for PWM channel

The RPi 2 and 3 have two PWM channels and 3 PWM pins available to the
gpio header.  BCM18 and BCM12 run on PWM channel 0.  BCM13 runs on PWM
channel 1.  This change allows BCM13 to be used by allowing the PWM
channel to be specified.


Former-commit-id: 3693ab438c2b369e6307c262d32bba509409e5b9
This commit is contained in:
Mark Walker
2016-03-20 21:22:19 -07:00
parent bb9b3808e0
commit d2973ff20b
3 changed files with 26 additions and 19 deletions

View File

@@ -327,8 +327,9 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
const int leds = deviceConfig.get("leds", 12).asInt();
const uint32_t freq = deviceConfig.get("freq", (Json::UInt)800000ul).asInt();
const int dmanum = deviceConfig.get("dmanum", 5).asInt();
const int pwmchannel = deviceConfig.get("pwmchannel", 0).asInt();
LedDeviceWS281x * ledDeviceWS281x = new LedDeviceWS281x(gpio, leds, freq, dmanum);
LedDeviceWS281x * ledDeviceWS281x = new LedDeviceWS281x(gpio, leds, freq, dmanum, pwmchannel);
device = ledDeviceWS281x;
}
#endif