add package.json and update enttec drive to use the ftdi module from npm

This commit is contained in:
Sebastian Wiedenroth 2013-11-16 17:35:17 +01:00
parent 51833110da
commit fe66de26d1
2 changed files with 39 additions and 11 deletions

View file

@ -1,5 +1,4 @@
var Ftdi = require('./node-ftdi/index'); var FTDI = require('ftdi')
var ENTTEC_PRO_DMX_STARTCODE = 0x00 var ENTTEC_PRO_DMX_STARTCODE = 0x00
, ENTTEC_PRO_START_OF_MSG = 0x7e , ENTTEC_PRO_START_OF_MSG = 0x7e
@ -24,18 +23,21 @@ exports.init = function(dev_id) {
universe, universe,
Buffer([ENTTEC_PRO_END_OF_MSG]) Buffer([ENTTEC_PRO_END_OF_MSG])
]) ])
//console.log(msg)
dev.write(msg)
dev.write(msg) dev.write(msg)
} }
var universe = new Buffer(512) var universe = new Buffer(512)
universe.fill(0) universe.fill(0)
var dev = new Ftdi({'index': dev_id}); var dev = new FTDI.FtdiDevice(dev_id)
dev.open(); dev.open({
dev.setBaudrate(250000); 'baudrate': 250000,
dev.setLineProperty(Ftdi.BITS_8, Ftdi.STOP_BIT_2, Ftdi.NONE); 'databits': 8,
'stopbits': 2,
'parity': 'none'
}, function(err) {
console.log(err)
})
this.update = function(u) { this.update = function(u) {
for(var k in u) { for(var k in u) {
@ -44,12 +46,12 @@ exports.init = function(dev_id) {
} }
this.get = function(c) { this.get = function(c) {
return universe[c]; return universe[c]
} }
setInterval(function() { setInterval(function() {
send_universe(dev, universe); send_universe(dev, universe);
}, 25); }, 25)
return this; return this;
} }

26
package.json Normal file
View file

@ -0,0 +1,26 @@
{
"name": "dmx",
"version": "0.0.1",
"author": "Sebastian Wiedenroth <wiedi@frubar.net>",
"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"
}
]
}