From fe66de26d1345480ee20ddcd3e6c255105f6c57e Mon Sep 17 00:00:00 2001 From: Sebastian Wiedenroth Date: Sat, 16 Nov 2013 17:35:17 +0100 Subject: [PATCH] add package.json and update enttec drive to use the ftdi module from npm --- drivers/enttec-usb-dmx-pro.js | 24 +++++++++++++----------- package.json | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 package.json diff --git a/drivers/enttec-usb-dmx-pro.js b/drivers/enttec-usb-dmx-pro.js index ca2bb48..9dc6e91 100644 --- a/drivers/enttec-usb-dmx-pro.js +++ b/drivers/enttec-usb-dmx-pro.js @@ -1,5 +1,4 @@ -var Ftdi = require('./node-ftdi/index'); - +var FTDI = require('ftdi') var ENTTEC_PRO_DMX_STARTCODE = 0x00 , ENTTEC_PRO_START_OF_MSG = 0x7e @@ -24,19 +23,22 @@ exports.init = function(dev_id) { universe, Buffer([ENTTEC_PRO_END_OF_MSG]) ]) - //console.log(msg) - dev.write(msg) dev.write(msg) } var universe = new Buffer(512) universe.fill(0) - var dev = new Ftdi({'index': dev_id}); - dev.open(); - dev.setBaudrate(250000); - dev.setLineProperty(Ftdi.BITS_8, Ftdi.STOP_BIT_2, Ftdi.NONE); - + var dev = new FTDI.FtdiDevice(dev_id) + dev.open({ + 'baudrate': 250000, + 'databits': 8, + 'stopbits': 2, + 'parity': 'none' + }, function(err) { + console.log(err) + }) + this.update = function(u) { for(var k in u) { universe[k] = u[k] @@ -44,12 +46,12 @@ exports.init = function(dev_id) { } this.get = function(c) { - return universe[c]; + return universe[c] } setInterval(function() { send_universe(dev, universe); - }, 25); + }, 25) return this; } diff --git a/package.json b/package.json new file mode 100644 index 0000000..ccb9533 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "dmx", + "version": "0.0.1", + "author": "Sebastian Wiedenroth ", + "description": "DMX library and webservice", + "url": "https://github.com/wiedi/node-dmx", + "main": "dmx.js", + "repository": { + "type": "git", + "url": "https://github.com/wiedi/node-dmx.git" + }, + "keywords": [ + "DMX", + "light control" + ], + "dependencies": { + "ftdi": "1.0.x", + "socket.io": "0.9.x" + }, + "licenses": [ + { + "name": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + } + ] +} \ No newline at end of file