2018-02-14 19:03:20 -08:00
|
|
|
/*
|
2018-02-23 10:37:30 -08:00
|
|
|
* i2c bus with named pipe socket - run on same machine/host as bus
|
2018-02-14 19:03:20 -08:00
|
|
|
*
|
|
|
|
*/
|
2018-05-28 14:47:52 -07:00
|
|
|
import Device from '../src/device'
|
2018-02-14 19:03:20 -08:00
|
|
|
// const PATH = ''
|
|
|
|
|
|
|
|
;
|
|
|
|
(async () => {
|
|
|
|
|
2018-05-28 14:47:52 -07:00
|
|
|
let device = new Device({id:'an i2c device', useRootNS:true, address:0x27})
|
2018-02-14 19:03:20 -08:00
|
|
|
|
|
|
|
device.reply = function (packet) {
|
|
|
|
console.log('for request ',packet._header)
|
|
|
|
console.log('bus response is ',packet.response)
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log((await device.init()).scan)
|
|
|
|
process.kill(process.pid, 'SIGTERM')
|
|
|
|
|
|
|
|
})().catch(err => {
|
|
|
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
|
|
|
process.kill(process.pid, 'SIGTERM')
|
|
|
|
})
|