0.1.21 allow path and port to come via ndevice and tdevice option props
parent
471ee2df1d
commit
6011e3e37a
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@uci/i2c-device",
|
||||
"version": "0.1.20",
|
||||
"version": "0.1.21",
|
||||
"description": "Device Classes for I2C Interfacing",
|
||||
"main": "src/device",
|
||||
"scripts": {
|
||||
|
@ -27,7 +27,7 @@
|
|||
"homepage": "https://github.com/uCOMmandIt/i2c#readme",
|
||||
"dependencies": {
|
||||
"@uci/base": "^0.1.30",
|
||||
"@uci-utils/logger": "0.0.15"
|
||||
"@uci-utils/logger": "^0.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
|
|
|
@ -7,15 +7,15 @@ class I2CDevice extends Base {
|
|||
constructor(opts) {
|
||||
opts.ndevice = opts.ndevice || {}
|
||||
opts.tdevice = opts.tdevice || {}
|
||||
opts.ndevice.path = opts.path || 'i2c-device'
|
||||
opts.tdevice.port = opts.port || 1777
|
||||
opts.ndevice.path = opts.ndevice.path || opts.path || 'i2c-device'
|
||||
opts.tdevice.port = opts.tdevice.port || opts.port || 1777
|
||||
opts.bus = opts.bus || {}
|
||||
if (opts.bus.host) opts.bus.port = opts.bus.port || 1776
|
||||
else opts.bus.path = opts.bus.path || 'i2c-bus'
|
||||
super(opts)
|
||||
this.addSocket('bus','c',opts.bus.host ? 't':'n',opts.bus)
|
||||
this.addSocket('device:tcp','s','t',opts.tdevice)
|
||||
this.addSocket('device:np','s','n',opts.ndevice)
|
||||
this.addSocket(opts.tdevice.name ||'device:tcp','s','t',opts.tdevice)
|
||||
this.addSocket(opts.ndevice.name ||'device:np','s','n',opts.ndevice)
|
||||
|
||||
log = logger({
|
||||
file: 'src/device-packet.js',
|
||||
|
|
Loading…
Reference in New Issue