Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function initialise(red, green, blue) {
if (red && green && blue) {
pigpio.configureClock(10, pigpio.CLOCK_PWM); // Configures PiGPIO to use PWM as clock source (by default it uses PCM which conflicts with BeoCreate 4-Channel Amplifier).
pigpio.initialize(); // pigpio C library initialized here
ledR = new pigpio.Gpio(red, {mode: pigpio.Gpio.OUTPUT});
ledG = new pigpio.Gpio(green, {mode: pigpio.Gpio.OUTPUT});
ledB = new pigpio.Gpio(blue, {mode: pigpio.Gpio.OUTPUT});
ledInitialised = true;
beoBus.emit("general", {header: "requestShutdownTime", content: {extension: "led"}});
return true;
} else {
return false;
}
}
module.exports.create = function(ws, uiConfig) {
// Tells the underlying gpio library to use the
// PWM pin as a clock source, rather than the PCM
// pin that provides I2S audio to DACs
pigpio.configureClock(5 /* pigpio's default duty cycle */, pigpio.CLOCK_PWM);
const io = new IO({
enableSoftPwm: true,
// Only enable pins used in the config
// to avoid clashing with other components
includePins: collectPinNumbers(uiConfig)
});
var board = new five.Board({
io: io,
repl: false
});
var types = Object.keys(factories);
var instances = {};
function initialise(red, green, blue) {
if (red, green, blue) {
pigpio.configureClock(10, pigpio.CLOCK_PWM); // Configures PiGPIO to use PWM as clock source (by default it uses PCM which conflicts with BeoCreate 4-Channel Amplifier).
ledR = new pigpio.Gpio(red, {mode: pigpio.Gpio.OUTPUT});
ledG = new pigpio.Gpio(green, {mode: pigpio.Gpio.OUTPUT});
ledB = new pigpio.Gpio(blue, {mode: pigpio.Gpio.OUTPUT});
ledInitialised = true;
return true;
} else {
return false;
}
}