refactoring into unified uci library

master
David Kebler 2017-01-13 19:51:55 -08:00
parent 29503c31af
commit ad95a16e89
2 changed files with 19 additions and 19 deletions

View File

@ -2,19 +2,20 @@
const i2c = require('i2c-bus'),
pA = require('bluebird').promisifyAll,
PQ = require('promisqueue')
pQ = require('promisqueue')
// TODO Create a Bus master class then BusRPi classes etc for actual hardware.
class Bus {
constructor(busnum) {
this.methods = pA(i2c.open(busnum,()=>{}),{suffix: "_p" }) //,multiArgs: true})
this.q = new PQ({ limit: 1})
this.methods = pA(i2c.open(busnum, () => {}), { suffix: "_p" }) //,multiArgs: true})
this.q = new pQ({ limit: 1 })
}
scan(){ return this.bus.scan_p()}
close(){ return this.bus.close_p()}
scan() { return this.bus.scan_p() }
close() { return this.bus.close_p() }
qAdd(job){this.q.add(() => job)}
qAdd(job) { this.q.add(() => job) }
} // end of Bus Class

View File

@ -1,7 +1,7 @@
{
"name": "uci-template-changeme",
"name": "uci-i2c",
"version": "0.0.1",
"description": "A template for a starting a uci package",
"description": "Bus and Device Classes for I2C Interfacing",
"main": "index.js",
"scripts": {
"testw": "./node_modules/.bin/mocha --reporter list --recursive --watch",
@ -11,20 +11,19 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/uCOMmandIt/uci-pkg-template.git"
"url": "git+https://github.com/uCOMmandIt/i2c.git"
},
"keywords": [
"node.js",
"communication",
"serial",
"utilities",
"helpers"
"node.js"
],
"bugs": {
"url": "https://github.com/uCOMmandIt/utilities/issues"
"url": "https://github.com/uCOMmandIt/i2c/issues"
},
"homepage": "https://github.com/uCOMmandIt/utilities#readme",
"homepage": "https://github.com/uCOMmandIt/i2c#readme",
"dependencies": {
"bluebird": "^3.4.7",
"i2c-bus": "^1.2.0",
"promisqueue": "^1.0.3",
"require-all": "git+https://github.com/dkebler/node-require-all.git#merge"
},
"devDependencies": {