uci-i2c-device/examples/ipc-scan.js

25 lines
570 B
JavaScript

/*
* i2c bus with named pipe socket - run on same machine/host as bus
*
*/
import Device from '../src/device'
// const PATH = ''
;
(async () => {
let device = new Device({id:'an i2c device', useRootNS:true, address:0x27})
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')
})