0.1.21 allow path and port to come via ndevice and tdevice option props
parent
471ee2df1d
commit
6011e3e37a
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "@uci/i2c-device",
|
"name": "@uci/i2c-device",
|
||||||
"version": "0.1.20",
|
"version": "0.1.21",
|
||||||
"description": "Device Classes for I2C Interfacing",
|
"description": "Device Classes for I2C Interfacing",
|
||||||
"main": "src/device",
|
"main": "src/device",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"example": "node -r esm examples/example --preserve-symlinks || true",
|
"example": "node -r esm examples/example --preserve-symlinks || true",
|
||||||
"example:dev": "UCI_ENV=dev ./node_modules/.bin/nodemon -r esm examples/example --preserve-symlinks || true" ,
|
"example:dev": "UCI_ENV=dev ./node_modules/.bin/nodemon -r esm examples/example --preserve-symlinks || true",
|
||||||
"testw": "./node_modules/.bin/mocha --reporter list --recursive --watch",
|
"testw": "./node_modules/.bin/mocha --reporter list --recursive --watch",
|
||||||
"test": "istanbul cover ./node_modules/.bin/_mocha test/ --report lcovonly -- -R spec --recursive && codecov || true"
|
"test": "istanbul cover ./node_modules/.bin/_mocha test/ --report lcovonly -- -R spec --recursive && codecov || true"
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
"homepage": "https://github.com/uCOMmandIt/i2c#readme",
|
"homepage": "https://github.com/uCOMmandIt/i2c#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uci/base": "^0.1.30",
|
"@uci/base": "^0.1.30",
|
||||||
"@uci-utils/logger": "0.0.15"
|
"@uci-utils/logger": "^0.0.15"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
|
|
|
@ -7,15 +7,15 @@ class I2CDevice extends Base {
|
||||||
constructor(opts) {
|
constructor(opts) {
|
||||||
opts.ndevice = opts.ndevice || {}
|
opts.ndevice = opts.ndevice || {}
|
||||||
opts.tdevice = opts.tdevice || {}
|
opts.tdevice = opts.tdevice || {}
|
||||||
opts.ndevice.path = opts.path || 'i2c-device'
|
opts.ndevice.path = opts.ndevice.path || opts.path || 'i2c-device'
|
||||||
opts.tdevice.port = opts.port || 1777
|
opts.tdevice.port = opts.tdevice.port || opts.port || 1777
|
||||||
opts.bus = opts.bus || {}
|
opts.bus = opts.bus || {}
|
||||||
if (opts.bus.host) opts.bus.port = opts.bus.port || 1776
|
if (opts.bus.host) opts.bus.port = opts.bus.port || 1776
|
||||||
else opts.bus.path = opts.bus.path || 'i2c-bus'
|
else opts.bus.path = opts.bus.path || 'i2c-bus'
|
||||||
super(opts)
|
super(opts)
|
||||||
this.addSocket('bus','c',opts.bus.host ? 't':'n',opts.bus)
|
this.addSocket('bus','c',opts.bus.host ? 't':'n',opts.bus)
|
||||||
this.addSocket('device:tcp','s','t',opts.tdevice)
|
this.addSocket(opts.tdevice.name ||'device:tcp','s','t',opts.tdevice)
|
||||||
this.addSocket('device:np','s','n',opts.ndevice)
|
this.addSocket(opts.ndevice.name ||'device:np','s','n',opts.ndevice)
|
||||||
|
|
||||||
log = logger({
|
log = logger({
|
||||||
file: 'src/device-packet.js',
|
file: 'src/device-packet.js',
|
||||||
|
|
Loading…
Reference in New Issue