Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var i2c1 = null
if(process.platform != 'darwin'){
// doesnt work on mac, so conditional to run on pi
const i2cBus = require('i2c-bus')
i2c1 = i2cBus.open(1, function(err){
if(err){
console.log("i2c error: "+err )
} else {
console.log("I2C OPEN")
}
})
}
module.exports = function(){
var i2c = {}
i2c.sendByte = function(addr, cmd, byte) {
if(i2c1){
i2c1.writeByte(addr, cmd, byte, function(){})
}
fs.readFile(path.join(__dirname, './font.json'), 'utf8', function(err, text) {
if(err) {
return done(err);
}
that.font = JSON.parse(text);
that.wire = i2c.open(1, function(err) {
that.wire.writeByte(i2c_address, cmd_set_mode, parseInt(mode_5x11, 2), function(){
done(err);
});
});
});
};
function (cb) {
i2c1 = i2c.open(I2C_CONTROLLER_NAME, cb);
},
function (cb) {