0.1.22 refactor bus functions so they are generated from a common function.
use the uci/base processing and namespaces add a queue for bus function calls rework all the examples fix a default IDmaster
parent
85b1332da0
commit
96472b71f8
|
@ -39,7 +39,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uci-utils/logger": "^0.0.15",
|
"@uci-utils/logger": "^0.0.15",
|
||||||
"@uci/base": "^0.1.27",
|
"@uci/base": "^0.1.30",
|
||||||
"better-try-catch": "^0.6.2",
|
"better-try-catch": "^0.6.2",
|
||||||
"p-queue": "^6.1.1",
|
"p-queue": "^6.1.1",
|
||||||
"pify": "^4.0.1"
|
"pify": "^4.0.1"
|
||||||
|
|
13
src/bus.js
13
src/bus.js
|
@ -10,12 +10,6 @@ let log = {}
|
||||||
|
|
||||||
class I2CBus extends Base {
|
class I2CBus extends Base {
|
||||||
constructor(opts) {
|
constructor(opts) {
|
||||||
log = logger({
|
|
||||||
name: 'i2c-bus',
|
|
||||||
id: opts.id,
|
|
||||||
file: 'src/bus.js',
|
|
||||||
class: 'Bus'
|
|
||||||
})
|
|
||||||
if (opts.path) opts.ns = { path: opts.path }
|
if (opts.path) opts.ns = { path: opts.path }
|
||||||
if (!opts.ns) opts.ns = { path: 'i2c-bus' }
|
if (!opts.ns) opts.ns = { path: 'i2c-bus' }
|
||||||
opts.sockets = (opts.sockets ? opts.sockets + ',' : '') + 'ns#s>n'
|
opts.sockets = (opts.sockets ? opts.sockets + ',' : '') + 'ns#s>n'
|
||||||
|
@ -26,6 +20,13 @@ class I2CBus extends Base {
|
||||||
opts.sockets = (opts.sockets ? opts.sockets + ',' : '') + 'ts#s>t'
|
opts.sockets = (opts.sockets ? opts.sockets + ',' : '') + 'ts#s>t'
|
||||||
}
|
}
|
||||||
super(opts)
|
super(opts)
|
||||||
|
this.id = opts.id || 'i2c-bus'
|
||||||
|
log = logger({
|
||||||
|
name: 'i2c-bus',
|
||||||
|
id: this.id,
|
||||||
|
file: 'src/bus.js',
|
||||||
|
class: 'Bus'
|
||||||
|
})
|
||||||
log.debug({ opts: opts }, 'created bus with these opts')
|
log.debug({ opts: opts }, 'created bus with these opts')
|
||||||
this.busnum = opts.busnum || 1
|
this.busnum = opts.busnum || 1
|
||||||
this.i2cbus = i2c.open(this.busnum, () => {})
|
this.i2cbus = i2c.open(this.busnum, () => {})
|
||||||
|
|
Loading…
Reference in New Issue