kelly / node-i2c

Node.js native bindings for i2c-dev. Plays well with Raspberry Pi and Beaglebone.
Other
216 stars 91 forks source link

feat: add callback to i2c constructor #88

Open matheussampaio opened 7 years ago

matheussampaio commented 7 years ago

Add a optional callback to I2C constructor.

const i2c = new I2C(DEFAULT_DDCCI_ADDR, { device: '/dev/i2c-1' }, (error) => {
  if (error) {
    console.error(error);
  } else {
    console.log('success');
  }
});
matheussampaio commented 7 years ago

This closes Issues #76.

rzr commented 5 years ago

Looks good, an other option would be to align iotjs i2c.open API : https://github.com/jerryscript-project/iotjs/blob/master/docs/api/IoT.js-API-I2C.md

rzr commented 4 years ago

May I suggest to consider to forward to abandonware fork

Relate-to: https://github.com/kelly/node-i2c/issues/97