fix bad comment
parent
a46e9501eb
commit
35605352bf
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@uci/mcp",
|
"name": "@uci/mcp",
|
||||||
"main": "src/mcp23008-17.js",
|
"main": "src/mcp23008-17.js",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"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",
|
||||||
|
|
|
@ -4,7 +4,7 @@ const Device = require('@uci/i2c').Device,
|
||||||
portpin = require('./port-pin'), // classes for MCP port and pins
|
portpin = require('./port-pin'), // classes for MCP port and pins
|
||||||
EventEmitter = require('events'),
|
EventEmitter = require('events'),
|
||||||
_ = require('@uci/utils'),
|
_ = require('@uci/utils'),
|
||||||
aggregate = require("aggregation/es6")
|
aggregate = require('aggregation/es6')
|
||||||
|
|
||||||
const
|
const
|
||||||
Port = portpin.Port,
|
Port = portpin.Port,
|
||||||
|
@ -115,7 +115,7 @@ class MCP23008 extends aggregate(Device, EventEmitter) {
|
||||||
|
|
||||||
// pin configurations should already be set before calling
|
// pin configurations should already be set before calling
|
||||||
async writePinsCfg() {
|
async writePinsCfg() {
|
||||||
debug.L1(`writing mcp pins config`)
|
debug.L1('writing mcp pins config')
|
||||||
for (let port in this.ports) {
|
for (let port in this.ports) {
|
||||||
for (let setting in registers.pin_config) {
|
for (let setting in registers.pin_config) {
|
||||||
let reg = registers.pin_config[setting]
|
let reg = registers.pin_config[setting]
|
||||||
|
@ -128,7 +128,7 @@ class MCP23008 extends aggregate(Device, EventEmitter) {
|
||||||
await this.write(portReg(reg, port), byte)
|
await this.write(portReg(reg, port), byte)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug.L1(`done writing mcp pins config`)
|
debug.L1('done writing mcp pins config')
|
||||||
} // end writePinsCfg
|
} // end writePinsCfg
|
||||||
|
|
||||||
async readPort(port, opts = {}) {
|
async readPort(port, opts = {}) {
|
||||||
|
@ -154,7 +154,7 @@ class MCP23008 extends aggregate(Device, EventEmitter) {
|
||||||
port = 'A'
|
port = 'A'
|
||||||
}
|
}
|
||||||
await this.readPort(port, opts)
|
await this.readPort(port, opts)
|
||||||
TODO return just true or false not the decimal of pin - will need new version on npm
|
// 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
|
return this.ports[port].state.bwOp(Math.pow(2, pin - 1), 'check') ? true : false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue