kelly / node-i2c

Node.js native bindings for i2c-dev. Plays well with Raspberry Pi and Beaglebone.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

constructor callback for wrapped Open in constructor to get err and make async

Andrewiski opened this issue · comments

given the code block below from your source there is no way to pass in a callback to get the Err on the constructor either via options or third param of Callbak

`constructor: (@address, @options = {}) ->
_.defaults @options,
debug: false
device: "/dev/i2c-1"

if @options.debug 
  require('repl').start(
    prompt: "i2c > "
  ).context.wire = @
  process.stdin.emit 'data', '' # trigger repl

process.on 'exit', => @close()

@on 'data', (data) => 
  @history.push data

@on 'error', (err) ->
  console.log "Error: #{error}"

@open @options.device, (err) =>
  unless err then @setAddress @address

`