nebrius / raspi-i2c

Provides access to I2C on the Raspberry Pi from Node.js
MIT License
30 stars 9 forks source link

Normalize callbacks #5

Open nebrius opened 9 years ago

nebrius commented 9 years ago

The callbacks for the async methods are not consistent both between and within raspi-i2c methods, depending on which i2c-bus method was called. These need to be wrapped and normalized

fivdi commented 9 years ago

@bryan-m-hughes what are the inconsistencies here?

nebrius commented 9 years ago

@fivdi it's in writeByte and writeWord. If a register is not specified, we call i2cWrite under the hood, which calls it's callback with (err, bytesWritten, buffer), but if we do specify a register, we call writeByte under the hood which only calls back with (err). Same thing with the *Word variants