kelly / node-i2c

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

Update i2c for Node js 'Nan' module (Resolve bugs #69 and #75) #77

Closed alphacharlie closed 8 years ago

alphacharlie commented 8 years ago

The following updates the i2c node module to use Nan wrappers to v8 in order to allow the module to be built on Node.js versions > 4.0.0 (and perhaps also < 0.12?) and to resolve bugs #69 and #75

I've rewritten the i2c.cc file to use the Nan versions of objects and methods where possible. It represents a fairly extensive rewrite of that file. But I've tried to leave the syntax and structure alone. (This was possible because the Nan wrappers look a lot like their v8 counterparts.)

Note - This code has been tested on Node.js versions 4.4.5 and 6.2.1 but only on armhf (Raspberry Pi 2, oDroid XU3/C0) so far.

Also - fixed the license string in Package.json to be valid and match the 3 clause BSD license in the source package.

'Nother Note- As pointed out by @Maus34 Nan relies on c++11 so you'll need g++ 4.8 or greater.