return boolean for read pin instead of pin number
parent
6dcd4da327
commit
a46e9501eb
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@uci/mcp",
|
"name": "@uci/mcp",
|
||||||
"main": "src/mcp23008-17.js",
|
"main": "src/mcp23008-17.js",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"description": "Classes and Helper Functions for using the MCP chip on I2C Bus",
|
"description": "Classes and Helper Functions for using the MCP chip on I2C Bus",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "./node_modules/.bin/mocha --reporter list --timeout 30000",
|
"test": "./node_modules/.bin/mocha --reporter list --timeout 30000",
|
||||||
|
|
|
@ -154,7 +154,8 @@ class MCP23008 extends aggregate(Device, EventEmitter) {
|
||||||
port = 'A'
|
port = 'A'
|
||||||
}
|
}
|
||||||
await this.readPort(port, opts)
|
await this.readPort(port, opts)
|
||||||
return this.ports[port].state.bwOp(Math.pow(2, pin - 1), 'check')
|
TODO return just true or false not the decimal of pin - will need new version on npm
|
||||||
|
return this.ports[port].state.bwOp(Math.pow(2, pin - 1), 'check') ? true : false
|
||||||
}
|
}
|
||||||
|
|
||||||
async writePort(byte, op, port = 'A') {
|
async writePort(byte, op, port = 'A') {
|
||||||
|
@ -241,7 +242,10 @@ class MCP23017 extends MCP23008 {
|
||||||
return this.ports[port].pin(id)
|
return this.ports[port].pin(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pid(num, port) { return this.ports[port].pins[num - 1].id }
|
pid(num, port) {
|
||||||
|
console.log('pin for pid',this.ports[port].pins[num - 1])
|
||||||
|
return this.ports[port].pins[num - 1].id
|
||||||
|
}
|
||||||
|
|
||||||
} // end MCP23017 Class
|
} // end MCP23017 Class
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue