2018-01-31 18:42:11 -08:00
|
|
|
/*
|
2018-05-27 11:41:33 -07:00
|
|
|
* Basic i2c bus listening at 1776 (by default when tcp:true) and also named pipe 'i2c-bus' by default in default /tmp directory
|
2018-01-31 18:42:11 -08:00
|
|
|
*
|
|
|
|
*/
|
2018-05-27 11:41:33 -07:00
|
|
|
import Bus from '../src/bus'
|
|
|
|
// can use SOCKETS_DIR='' env variable to get a 'i2c-bus.sock' in a particular directory
|
|
|
|
// e.g. SOCKETS_DIR=/opt/sockets node -r @std/esm i2cbus
|
2018-02-04 14:19:44 -08:00
|
|
|
;
|
2018-01-31 18:42:11 -08:00
|
|
|
(async () => {
|
|
|
|
|
2018-03-04 15:11:54 -08:00
|
|
|
let i2cbus = new Bus({id:'i2c-bus',tcp:true})
|
2018-01-31 18:42:11 -08:00
|
|
|
|
|
|
|
await i2cbus.init()
|
|
|
|
|
|
|
|
})().catch(err => {
|
|
|
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
|
|
|
})
|