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
|
2019-09-11 18:34:54 -07:00
|
|
|
|
|
|
|
const CONCURRENCY = 1
|
|
|
|
|
2018-02-04 14:19:44 -08:00
|
|
|
;
|
2018-01-31 18:42:11 -08:00
|
|
|
(async () => {
|
|
|
|
|
2019-09-11 18:34:54 -07:00
|
|
|
let i2cbus = new Bus({id:'i2c-busx',tcp:true, concurrency:CONCURRENCY})
|
2018-01-31 18:42:11 -08:00
|
|
|
|
|
|
|
await i2cbus.init()
|
|
|
|
|
|
|
|
})().catch(err => {
|
|
|
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
|
|
|
})
|