working on interrupt init
parent
8368b5d3fe
commit
ba2db815e5
|
@ -19,17 +19,23 @@ class MCP23008 extends Device {
|
|||
init() {
|
||||
// console.log('chip configuration', chip_config.cmd, chipSetByte())
|
||||
// console.log(super.write.toString())
|
||||
let jobs = [super.write(chip_config.cmd, chipSetByte(this.chip_config))] // configure chip
|
||||
let jobs = [() => { return super.write(chip_config.cmd, chipSetByte(this.chip_config)) }] // configure chip
|
||||
for (let port in this.ports) {
|
||||
if (this.ports[port].interrupt) { jobs.push(this.ports[port].interrupt.init()) }
|
||||
if (this.inter(port)) {
|
||||
console.log('interrupt init', this.inter(port).init().toString())
|
||||
jobs.push(() => { return this.inter(port).init() })
|
||||
}
|
||||
jobs.push(this.writePinsCfg())
|
||||
}
|
||||
jobs.push(() => { return this.writePinsCfg() })
|
||||
return _u.pSeries(jobs)
|
||||
}
|
||||
|
||||
pin(id) { return this.ports.A.pin(id) } // get a reference to a particular pin's object
|
||||
|
||||
interrupt(port = 'A') { return this.ports[port].interrupt }
|
||||
inter(port = 'A') {
|
||||
|
||||
return this.ports[port].interrupt
|
||||
}
|
||||
|
||||
// pin configurations should already be set before calling
|
||||
writePinsCfg() {
|
||||
|
@ -133,7 +139,6 @@ class MCP23017 extends MCP23008 {
|
|||
opts.portID = 'B'
|
||||
this.ports.B = new Port(opts)
|
||||
this.ports.B.interrupt = opts.interruptB ? opts.interruptB : opts.interrupt
|
||||
|
||||
}
|
||||
|
||||
pin(id, port) {
|
||||
|
|
Loading…
Reference in New Issue