2018-02-08 09:19:46 -08:00
|
|
|
/*
|
|
|
|
* i2c bus with both unix and tcp socket using defaults. For TCP that is host OS name and port 8080
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
import MCP230XX from '../src/mcp230xx-packet'
|
|
|
|
// const PATH = ''
|
|
|
|
|
|
|
|
;
|
|
|
|
(async () => {
|
|
|
|
|
2018-02-17 18:25:27 -08:00
|
|
|
// let chip8 = new MCP230XX({id:'mcp8-27', address:0x27, nmcp: { path: '/opt/sockets/mcp2.sock' }})
|
|
|
|
let chip17 = new MCP230XX({id:'mcp17-26', chip17:true, address:0x26})
|
2018-02-08 09:19:46 -08:00
|
|
|
|
2018-02-17 18:25:27 -08:00
|
|
|
await chip17.init()
|
|
|
|
// await chip8.init()
|
|
|
|
console.log(await chip17.pin.cfg({pins:'all'}))
|
|
|
|
// console.log(await chip17.pin.cfg({pins:'all', cfg:'toggle_switch'}))
|
|
|
|
// console.log(await chip17.pin.cfg({pins:'all', port:'B', cfg:'toggle_switch'}))
|
|
|
|
// console.log(await chip8.pin.cfg({pins:'all', cfg:'toggle_switch'}))
|
2018-02-08 09:19:46 -08:00
|
|
|
|
|
|
|
})().catch(err => {
|
|
|
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
|
|
|
})
|