remove queue wrap of bus r/w
parent
25a3ca9095
commit
193b003d07
12
lib/bus.js
12
lib/bus.js
|
@ -26,27 +26,27 @@ class Bus {
|
||||||
close() { return pify(this.bus.close_p)() }
|
close() { return pify(this.bus.close_p)() }
|
||||||
|
|
||||||
readRaw(address, length, buffer) {
|
readRaw(address, length, buffer) {
|
||||||
return this.qAdd(pify(this.bus.i2cRead)(address, length, buffer))
|
return pify(this.bus.i2cRead)(address, length, buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
writeRaw(address, length, buffer) {
|
writeRaw(address, length, buffer) {
|
||||||
return this.qAdd(pify(this.bus.i2cWrite)(address, length, buffer))
|
return pify(this.bus.i2cWrite)(address, length, buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
read(address, cmd) {
|
read(address, cmd) {
|
||||||
return this.qAdd(pify(this.bus.readByte)(address, cmd))
|
return pify(this.bus.readByte)(address, cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
write(address, cmd, byte) {
|
write(address, cmd, byte) {
|
||||||
return this.qAdd(pify(this.bus.writeByte)(address, cmd, byte))
|
return pify(this.bus.writeByte)(address, cmd, byte)
|
||||||
}
|
}
|
||||||
|
|
||||||
read2(address, cmd) {
|
read2(address, cmd) {
|
||||||
return this.qAdd(pify(this.bus.readWord)(address, cmd))
|
return pify(this.bus.readWord)(address, cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
write2(address, cmd, bytes) {
|
write2(address, cmd, bytes) {
|
||||||
return this.qAdd(pify(this.bus.writeWord)(address, cmd, bytes))
|
return pify(this.bus.writeWord)(address, cmd, bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of Bus Class
|
} // end of Bus Class
|
||||||
|
|
|
@ -7,7 +7,7 @@ const expect = require('chai').expect,
|
||||||
let bus = new Bus()
|
let bus = new Bus()
|
||||||
// console.log(bus.write.toString())
|
// console.log(bus.write.toString())
|
||||||
|
|
||||||
bus.write(0x21, 0x09, 0xFF)
|
bus.write(0x20, 0x09, 0xFF)
|
||||||
|
|
||||||
describe('Bus Class - ', function () {
|
describe('Bus Class - ', function () {
|
||||||
|
|
||||||
|
@ -15,4 +15,4 @@ describe('Bus Class - ', function () {
|
||||||
// expect(pin.cfg, "config getter failed").to.deep.equal(gpio.configs('output'))
|
// expect(pin.cfg, "config getter failed").to.deep.equal(gpio.configs('output'))
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
})
|
||||||
|
|
Loading…
Reference in New Issue