Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

i2c-bus

fivdi6.7kMIT5.2.3TypeScript support: definitely-typed

I2C serial bus access with Node.js

i2c, iot, raspberry, raspi, rpi, pi, beaglebone, smbus, linux

readme

Build Status Coverage Status npm Version Downloads Per Month Mentioned in Awesome Node.js

i2c-bus

I2C serial bus access with Node.js on Linux boards like the Raspberry Pi or BeagleBone. The i2c-bus API supports promises and async/await, asynchronous callbacks and synchronous execution.

i2c-bus supports Node.js versions 10, 12, 14, 16, 18 and 20.

Contents

Installation

npm install i2c-bus

The way in which I2C is configured varies from board to board. Sometimes no configuraton is required, but sometimes it is:

Usage

The example programs below show how to use a MCP9808 I2C temperature sensor to determine the temperature.

MCP9808 I2C temperature sensor connected to a Raspberry Pi

Example 1 - Promises

Determine the temperature with a MCP9808 I2C temperature sensor using promises.

const i2c = require('i2c-bus');

const MCP9808_ADDR = 0x18;
const TEMP_REG = 0x05;

const toCelsius = rawData => {
  rawData = (rawData >> 8) + ((rawData & 0xff) << 8);
  let celsius = (rawData & 0x0fff) / 16;
  if (rawData & 0x1000) {
    celsius -= 256;
  }
  return celsius;
};

i2c.openPromisified(1).
then(i2c1 => i2c1.readWord(MCP9808_ADDR, TEMP_REG).
  then(rawData => console.log(toCelsius(rawData))).
  then(_ => i2c1.close())
).catch(console.log);

Example 2 - Promises, Plain I2C and Buffers

Determine the temperature with a MCP9808 I2C temperature sensor using promises, plain I2C and Buffer objects.

const i2c = require('i2c-bus');

const MCP9808_ADDR = 0x18;
const TEMP_REG = 0x05;

const toCelsius = rawData => {
  let celsius = (rawData & 0x0fff) / 16;
  if (rawData & 0x1000) {
    celsius -= 256;
  }
  return celsius;
};

const wbuf = Buffer.from([TEMP_REG]);
const rbuf = Buffer.alloc(2);

i2c.openPromisified(1).
then(i2c1 => i2c1.i2cWrite(MCP9808_ADDR, wbuf.length, wbuf).
  then(_ => i2c1.i2cRead(MCP9808_ADDR, rbuf.length, rbuf)).
  then(data => console.log(toCelsius(data.buffer.readUInt16BE()))).
  then(_ => i2c1.close())
).catch(console.log);

Example 3 - Asynchronous Callbacks

Determine the temperature with a MCP9808 I2C temperature sensor using asynchronous callbacks.

const i2c = require('i2c-bus');

const MCP9808_ADDR = 0x18;
const TEMP_REG = 0x05;

const toCelsius = rawData => {
  rawData = (rawData >> 8) + ((rawData & 0xff) << 8);
  let celsius = (rawData & 0x0fff) / 16;
  if (rawData & 0x1000) {
    celsius -= 256;
  }
  return celsius;
};

const i2c1 = i2c.open(1, err => {
  if (err) throw err;

  i2c1.readWord(MCP9808_ADDR, TEMP_REG, (err, rawData) => {
    if (err) throw err;

    console.log(toCelsius(rawData));

    i2c1.close(err => {
      if (err) throw err;
    });
  });
});

Example 4 - Synchronous Methods

Determine the temperature with a MCP9808 I2C temperature sensor using synchronous methods.

const i2c = require('i2c-bus');

const MCP9808_ADDR = 0x18;
const TEMP_REG = 0x05;

const toCelsius = rawData => {
  rawData = (rawData >> 8) + ((rawData & 0xff) << 8);
  let celsius = (rawData & 0x0fff) / 16;
  if (rawData & 0x1000) {
    celsius -= 256;
  }
  return celsius;
};

const i2c1 = i2c.openSync(1);
const rawData = i2c1.readWordSync(MCP9808_ADDR, TEMP_REG);
console.log(toCelsius(rawData));
i2c1.closeSync();

API

Functions

Class Bus

All methods in class Bus have asynchronous callback and synchronous forms. For promise support see class PromisifiedBus.

The asynchronous callback form always take a completion callback as its last argument. The arguments passed to the completion callback depend on the method, but the first argument is always reserved for an exception. If the operation was completed successfully, then the first argument will be null or undefined.

When using the synchronous form any exceptions are immediately thrown. You can use try/catch to handle exceptions or allow them to bubble up.

Class PromisifiedBus

All methods in class PromisifiedBus have the asynchronous promise form. For asynchronous callback and synchronous forms see class Bus.

Class I2cFuncs

open(busNumber [, options], cb)

  • busNumber - the number of the I2C bus/adapter to open, 0 for /dev/i2c-0, 1 for /dev/i2c-1, ...
  • options - an optional options object
  • cb - completion callback

Asynchronous open. Returns a new Bus object. The callback gets one argument (err).

The following options are supported:

  • forceAccess - A boolean value specifying whether access to devices on the I2C bus should be allowed even if they are already in use by a kernel driver/module. Corresponds to I2C_SLAVE_FORCE on Linux. The valid values for forceAccess are true and false. Optional, the default value is false.

openSync(busNumber [, options])

  • busNumber - the number of the I2C bus/adapter to open, 0 for /dev/i2c-0, 1 for /dev/i2c-1, ...
  • options - an optional options object

Synchronous open. Returns a new Bus object.

The following options are supported:

  • forceAccess - A boolean value specifying whether access to devices on the I2C bus should be allowed even if they are already in use by a kernel driver/module. Corresponds to I2C_SLAVE_FORCE on Linux. The valid values for forceAccess are true and false. Optional, the default value is false.

openPromisified(busNumber [, options])

  • busNumber - the number of the I2C bus/adapter to open, 0 for /dev/i2c-0, 1 for /dev/i2c-1, ...
  • options - an optional options object

Asynchronous open. Returns a Promise that, when resolved, yields a PromisifiedBus object.

The following options are supported:

  • forceAccess - A boolean value specifying whether access to devices on the I2C bus should be allowed even if they are already in use by a kernel driver/module. Corresponds to I2C_SLAVE_FORCE on Linux. The valid values for forceAccess are true and false. Optional, the default value is false.

bus.close(cb)

  • cb - completion callback

Asynchronous close. Frees system resources used by this instance. The callback gets one argument (err).

bus.closeSync()

Synchronous close. Frees system resources used by this instance.

bus.i2cFuncs(cb)

  • cb - completion callback

Determine functionality of the bus/adapter asynchronously. The callback gets two argument (err, funcs). funcs is a frozen I2cFuncs object describing the functionality available. See also I2C functionality.

bus.i2cFuncsSync()

Determine functionality of the bus/adapter Synchronously. Returns a frozen I2cFuncs object describing the functionality available. See also I2C functionality.

bus.scan([startAddr,] [endAddr,] cb)

  • startAddr - an integer specifying the start address of the scan range, optional
  • endAddr - an integer specifying the end addrerss of the scan range, optional
  • cb - completion callback

bus.scan(cb) - scan for I2C devices in address range 0x03 through 0x77
bus.scan(addr, cb) - scan for an I2C device at address addr
bus.scan(startAddr, endAddr, cb) - scan for I2C devices in address range startAddr through endAddr

Scans the I2C bus asynchronously for devices. The default address range 0x03 through 0x77 is the same as the default address range used by the i2cdetect command line tool. The callback gets two arguments (err, devices). devices is an array of numbers where each number represents the I2C address of a device which was detected.

bus.scanSync([startAddr,] [endAddr])

  • startAddr - an integer specifying the start address of the scan range, optional
  • endAddr - an integer specifying the end addrerss of the scan range, optional

bus.scan() - scan for I2C devices in address range 0x03 through 0x77
bus.scan(addr) - scan for an I2C device at address addr
bus.scan(startAddr, endAddr) - scan for I2C devices in address range startAddr through endAddr

Scans the I2C bus synchronously for devices. The default address range 0x03 through 0x77 is the same as the default address range used by the i2cdetect command line tool. Returns an array of numbers where each number represents the I2C address of a device which was detected.

bus.deviceId(addr, cb)

  • addr - I2C device address
  • cb - completion callback

Asynchronous I2C device Id. The callback gets two arguments (err, id). id is an object with the properties manufacturer, product and if known a human readable name for the associated manufacturer. manufacturer and product are numbers, name is a string.

bus.deviceIdSync(addr)

  • addr - I2C device address

Synchronous I2C device Id. Returns an object with the properties manufacturer, product and if known a human readable name for the associated manufacturer. manufacturer and product are numbers, name is a string.

bus.i2cRead(addr, length, buffer, cb)

  • addr - I2C device address
  • length - an integer specifying the number of bytes to read
  • buffer - the Buffer instance that the data will be written to (must conatin at least length bytes)
  • cb - completion callback

Asynchronous plain I2C read. The callback gets three argument (err, bytesRead, buffer). bytesRead is the number of bytes read.

bus.i2cReadSync(addr, length, buffer)

  • addr - I2C device address
  • length - an integer specifying the number of bytes to read
  • buffer - the Buffer instance that the data will be written to (must conatin at least length bytes)

Synchronous plain I2C read. Returns the number of bytes read.

bus.i2cWrite(addr, length, buffer, cb)

  • addr - I2C device address
  • length - an integer specifying the number of bytes to write
  • buffer - the Buffer instance containing the data to write (must conatin at least length bytes)
  • cb - completion callback

Asynchronous plain I2C write. The callback gets three argument (err, bytesWritten, buffer). bytesWritten is the number of bytes written.

bus.i2cWriteSync(addr, length, buffer)

  • addr - I2C device address
  • length - an integer specifying the number of bytes to write
  • buffer - the Buffer instance containing the data to write (must conatin at least length bytes)

Synchronous plain I2C write. Returns the number of bytes written.

bus.readByte(addr, cmd, cb)

  • addr - I2C device address
  • cmd - command code
  • cb - completion callback

Asynchronous SMBus read byte. The callback gets two arguments (err, byte). byte is an unsigned integer in the range 0 to 255.

bus.readByteSync(addr, cmd)

  • addr - I2C device address
  • cmd - command code

Synchronous SMBus read byte. Returns the byte read. byte is an unsigned integer in the range 0 to 255.

bus.readWord(addr, cmd, cb)

  • addr - I2C device address
  • cmd - command code
  • cb - completion callback

Asynchronous SMBus read word. The callback gets two arguments (err, word). word is an unsigned integer in the range 0 to 65535.

bus.readWordSync(addr, cmd)

  • addr - I2C device address
  • cmd - command code

Synchronous SMBus read word. Returns the word read. word is an unsigned integer in the range 0 to 65535.

bus.readI2cBlock(addr, cmd, length, buffer, cb)

  • addr - I2C device address
  • cmd - command code
  • length - an integer specifying the number of bytes to read (max 32)
  • buffer - the Buffer instance that the data will be written to (must conatin at least length bytes)
  • cb - completion callback

Asynchronous I2C block read (not defined by the SMBus specification). Reads a block of bytes from a device, from a designated register that is specified by cmd. The callback gets three arguments (err, bytesRead, buffer). bytesRead is the number of bytes read.

bus.readI2cBlockSync(addr, cmd, length, buffer)

  • addr - I2C device address
  • cmd - command code
  • length - an integer specifying the number of bytes to read (max 32)
  • buffer - the Buffer instance that the data will be written to (must conatin at least length bytes)

Synchronous I2C block read (not defined by the SMBus specification). Reads a block of bytes from a device, from a designated register that is specified by cmd. Returns the number of bytes read.

bus.receiveByte(addr, cb)

  • addr - I2C device address
  • cb - completion callback

Asynchronous SMBus receive byte. The callback gets two arguments (err, byte). byte is an unsigned integer in the range 0 to 255.

bus.receiveByteSync(addr)

  • addr - I2C device address

Synchronous SMBus receive byte. Returns the byte received. byte is an unsigned integer in the range 0 to 255.

bus.sendByte(addr, byte, cb)

  • addr - I2C device address
  • byte - data byte. byte is an unsigned integer in the range 0 to 255.
  • cb - completion callback

Asynchronous SMBus send byte. The callback gets one argument (err).

bus.sendByteSync(addr, byte)

  • addr - I2C device address
  • byte - data byte. byte is an unsigned integer in the range 0 to 255.

Synchronous SMBus send byte.

bus.writeByte(addr, cmd, byte, cb)

  • addr - I2C device address
  • cmd - command code
  • byte - data byte. byte is an unsigned integer in the range 0 to 255.
  • cb - completion callback

Asynchronous SMBus write byte. The callback gets one argument (err).

bus.writeByteSync(addr, cmd, byte)

  • addr - I2C device address
  • cmd - command code
  • byte - data byte. byte is an unsigned integer in the range 0 to 255.

Synchronous SMBus write byte.

bus.writeWord(addr, cmd, word, cb)

  • addr - I2C device address
  • cmd - command code
  • word - data word. word is an unsigned integer in the range 0 to 65535.
  • cb - completion callback

Asynchronous SMBus write word. The callback gets one argument (err).

bus.writeWordSync(addr, cmd, word)

  • addr - I2C device address
  • cmd - command code
  • word - data word. word is an unsigned integer in the range 0 to 65535.

Synchronous SMBus write word.

bus.writeQuick(addr, bit, cb)

  • addr - I2C device address
  • bit - bit to write (0 or 1)
  • cb - completion callback

Asynchronous SMBus quick command. Writes a single bit to the device. The callback gets one argument (err).

bus.writeQuickSync(addr, bit)

  • addr - I2C device address
  • bit - bit to write (0 or 1)

Synchronous SMBus quick command. Writes a single bit to the device.

bus.writeI2cBlock(addr, cmd, length, buffer, cb)

  • addr - I2C device address
  • cmd - command code
  • length - an integer specifying the number of bytes to write (max 32)
  • buffer - the Buffer instance containing the data to write (must conatin at least length bytes)
  • cb - completion callback

Asynchronous I2C block write (not defined by the SMBus specification). Writes a block of bytes to a device, to a designated register that is specified by cmd. The callback gets three argument (err, bytesWritten, buffer). bytesWritten is the number of bytes written.

bus.writeI2cBlockSync(addr, cmd, length, buffer)

  • addr - I2C device address
  • cmd - command code
  • length - an integer specifying the number of bytes to write (max 32)
  • buffer - the Buffer instance containing the data to write (must conatin at least length bytes)

Synchronous I2C block write (not defined by the SMBus specification). Writes a block of bytes to a device, to a designated register that is specified by cmd.

bus.promisifiedBus()

Return the PromisifiedBus instance for this Bus instance.

promisifiedBus.close()

Asynchronous close. Returns a Promise that will be resolved with no arguments once the underlying resources have been released, or will be rejected if an error occurs while closing.

promisifiedBus.i2cFuncs()

Determine functionality of the bus/adapter asynchronously. Returns a Promise that on success will be resolved with a frozen I2cFuncs object describing the functionality available. The returned Promise will be rejected if an error occurs. See also I2C functionality.

promisifiedBus.scan([startAddr,] [endAddr])

  • startAddr - an integer specifying the start address of the scan range, optional
  • endAddr - an integer specifying the end addrerss of the scan range, optional

bus.scan() - scan for I2C devices in address range 0x03 through 0x77
bus.scan(addr) - scan for an I2C device at address addr
bus.scan(startAddr, endAddr) - scan for I2C devices in address range startAddr through endAddr

Scans the I2C bus asynchronously for devices. The default address range 0x03 through 0x77 is the same as the default address range used by the i2cdetect command line tool. Returns a Promise that on success will be resolved with an array of numbers where each number represents the I2C address of a device which was detected. The returned Promise will be rejected if an error occurs.

promisifiedBus.deviceId(addr)

  • addr - I2C device address

Asynchronous I2C device Id. Returns a Promise that will be resolved with an id object on success, or will be rejected if an error occurs. id is an object with the properties manufacturer, product and if known a human readable name for the associated manufacturer. manufacturer and product are numbers, name is a string.

promisifiedBus.i2cRead(addr, length, buffer)

  • addr - I2C device address
  • length - an integer specifying the number of bytes to read
  • buffer - the Buffer instance that the data will be written to (must conatin at least length bytes)

Asynchronous plain I2C read. Returns a Promise that on success will be resolved with an object with a bytesRead property identifying the number of bytes read, and a buffer property that is a reference to the passed in buffer argument. The returned Promise will be rejected if an error occurs.

promisifiedBus.i2cWrite(addr, length, buffer)

  • addr - I2C device address
  • length - an integer specifying the number of bytes to write
  • buffer - the Buffer instance containing the data to write (must conatin at least length bytes)

Asynchronous plain I2C write. Returns a Promise that on success will be resolved with an object with a bytesWritten property identifying the number of bytes written, and a buffer property that is a reference to the passed in buffer argument. The returned promise will be rejected if an error occurs.

promisifiedBus.readByte(addr, cmd)

  • addr - I2C device address
  • cmd - command code

Asynchronous SMBus read byte. Returns a Promise that will be resolved with a number representing the byte read on success, or will be rejected if an error occurs. byte is an unsigned integer in the range 0 to 255.

promisifiedBus.readWord(addr, cmd)

  • addr - I2C device address
  • cmd - command code

Asynchronous SMBus read word. Returns a Promise that will be resolved with a number representing the word read on success, or will be rejected if an error occurs. word is an unsigned integer in the range 0 to 65535.

promisifiedBus.readI2cBlock(addr, cmd, length, buffer)

  • addr - I2C device address
  • cmd - command code
  • length - an integer specifying the number of bytes to read (max 32)
  • buffer - the Buffer instance that the data will be written to (must conatin at least length bytes)

Asynchronous I2C block read (not defined by the SMBus specification). Reads a block of bytes from a device, from a designated register that is specified by cmd. Returns a Promise that on success will be resolved with an object with a bytesRead property identifying the number of bytes read, and a buffer property that is a reference to the passed in buffer argument. The returned Promise will be rejected if an error occurs.

promisifiedBus.receiveByte(addr)

  • addr - I2C device address

Asynchronous SMBus receive byte. Returns a Promise that will be resolved with a number representing the byte received on success, or will be rejected if an error occurs. byte is an unsigned integer in the range 0 to 255.

promisifiedBus.sendByte(addr, byte)

  • addr - I2C device address
  • byte - data byte. byte is an unsigned integer in the range 0 to 255.

Asynchronous SMBus send byte. Returns a Promise that will be resolved with no arguments on success, or will be rejected if an error occurs.

promisifiedBus.writeByte(addr, cmd, byte)

  • addr - I2C device address
  • cmd - command code
  • byte - data byte. byte is an unsigned integer in the range 0 to 255.

Asynchronous SMBus write byte. Returns a Promise that will be resolved with no arguments on success, or will be rejected if an error occurs.

promisifiedBus.writeWord(addr, cmd, word)

  • addr - I2C device address
  • cmd - command code
  • word - data word. word is an unsigned integer in the range 0 to 65535.

Asynchronous SMBus write word. Returns a Promise that will be resolved with no arguments on success, or will be rejected if an error occurs.

promisifiedBus.writeQuick(addr, bit)

  • addr - I2C device address
  • bit - bit to write (0 or 1)

Asynchronous SMBus quick command. Writes a single bit to the device. Returns a Promise that will be resolved with no arguments on success, or will be rejected if an error occurs.

promisifiedBus.writeI2cBlock(addr, cmd, length, buffer)

  • addr - I2C device address
  • cmd - command code
  • length - an integer specifying the number of bytes to write (max 32)
  • buffer - the Buffer instance containing the data to write (must conatin at least length bytes)

Asynchronous I2C block write (not defined by the SMBus specification). Writes a block of bytes to a device, to a designated register that is specified by cmd. Returns a Promise that on success will be resolved with an object with a bytesWritten property identifying the number of bytes written, and a buffer property that is a reference to the passed in buffer argument. The returned promise will be rejected if an error occurs.

promisifiedBus.bus()

Return the Bus instance for this PromisifiedBus instance.

funcs.i2c - boolean

Specifies whether or not the adapter handles plain I2C-level commands (Pure SMBus adapters typically can not do these, I2C_FUNC_I2C).

funcs.tenBitAddr - boolean

Specifies whether or not the adapter handles the 10-bit address extensions (I2C_FUNC_10BIT_ADDR).

funcs.protocolMangling - boolean

Specifies whether or not the adapter knows about the I2C_M_IGNORE_NAK, I2C_M_REV_DIR_ADDR and I2C_M_NO_RD_ACK flags (which modify the I2C protocol! I2C_FUNC_PROTOCOL_MANGLING).

funcs.smbusPec - boolean

Specifies whether or not the adapter handles packet error checking (I2C_FUNC_SMBUS_PEC).

funcs.smbusBlockProcCall - boolean

Specifies whether or not the adapter handles the SMBus block process call command (I2C_FUNC_SMBUS_BLOCK_PROC_CALL).

funcs.smbusQuick - boolean

Specifies whether or not the adapter handles the SMBus quick command (I2C_FUNC_SMBUS_QUICK).

funcs.smbusReceiveByte - boolean

Specifies whether or not the adapter handles the SMBus receive byte command (I2C_FUNC_SMBUS_READ_BYTE).

funcs.smbusSendByte - boolean

Specifies whether or not the adapter handles the SMBus send byte command (I2C_FUNC_SMBUS_WRITE_BYTE).

funcs.smbusReadByte - boolean

Specifies whether or not the adapter handles the SMBus read byte command (I2C_FUNC_SMBUS_READ_BYTE_DATA).

funcs.smbusWriteByte - boolean

Specifies whether or not the adapter handles the SMBus write byte command (I2C_FUNC_SMBUS_WRITE_BYTE_DATA).

funcs.smbusReadWord - boolean

Specifies whether or not the adapter handles the SMBus read word command (I2C_FUNC_SMBUS_READ_WORD_DATA).

funcs.smbusWriteWord - boolean

Specifies whether or not the adapter handles the SMBus write word command (I2C_FUNC_SMBUS_WRITE_WORD_DATA).

funcs.smbusProcCall - boolean

Specifies whether or not the adapter handles the SMBus process call command (I2C_FUNC_SMBUS_PROC_CALL).

funcs.smbusReadBlock - boolean

Specifies whether or not the adapter handles the SMBus read block command (I2C_FUNC_SMBUS_READ_BLOCK_DATA).

funcs.smbusWriteBlock - boolean

Specifies whether or not the adapter handles the SMBus write block command (I2C_FUNC_SMBUS_WRITE_BLOCK_DATA).

funcs.smbusReadI2cBlock - boolean

Specifies whether or not the adapter handles the SMBus read I2C block command (I2C_FUNC_SMBUS_READ_I2C_BLOCK).

funcs.smbusWriteI2cBlock - boolean

Specifies whether or not the adapter handles the SMBus write i2c block command (I2C_FUNC_SMBUS_WRITE_I2C_BLOCK).

TypeScript Type Definitions

TypeScript type definitions for i2c-bus can be found in the Definitely Typed repository at https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/i2c-bus.

changelog

5.2.3 / Aug 06 2023

  • update dependencies
  • update information related to supported versions

5.2.2 / Apr 29 2021

  • remove news and updates section of readme
  • drop support for node.js 8 and 13, add support for node.js 15 & 16
  • update dependencies

5.2.1 / Oct 11 2020

  • add directories section to package.json

5.2.0 / Apr 24 2020

  • add unit tests for PromisifiedBus
  • update dependencies
  • drop support for node.js 6, add support for node.js 14

5.1.0 / Oct 03 2019

  • add bus.promisifiedBus and promisifiedBus.bus

5.0.0 / Sep 17 2019

  • drop support for node.js v4
  • add promise support
  • ensure that the properties of i2cFuncs objects are booleans rather than numbers

4.0.11 / Sep 07 2019

  • update dependencies (async v3.1.0, coveralls v3.0.6, lodash v4.17.15, mocha v6.2.0, sinon v7.4.2)

4.0.10 / Jun 16 2019

  • update dependencies
  • update npm keywords

4.0.9 / Mar 14 2019

  • add unit tests
  • update dependencies (nan v2.13.0, jshint v2.10.2)

4.0.8 / Mar 01 2019

  • add travis build
  • lint with jshint
  • update dependencies (bindings v1.5.0, async v2.6.2)
  • document node 11 support
  • add .npmignore and .npmrc

4.0.7 / Dec 19 2018

  • update dependencies (nan v2.12.1, bindings v1.3.1)

4.0.6 / Nov 18 2018

  • fix macOS installation

4.0.5 / Oct 14 2018

4.0.4 / Oct 13 2018

  • always compile c++ code

4.0.3 / Oct 13 2018

4.0.2 / Sep 30 2018

  • update dependencies (nan v2.11.1, async v2.6.1, lodash v4.17.11)
  • adapt to V8 7.0: replace v8Value->Int32Value() with Nan::To<int32_t>(v8Value).FromJust()
  • adapt to V8 7.0: replace v8Value->Uint32Value() with Nan::To<uint32_t>(v8Value).FromJust()
  • adapt to V8 7.0: replace v8Value->BooleanValue() with Nan::To<bool>(v8Value).FromJust()

4.0.1 / Jul 28 2018

  • code style

4.0.0 / Jul 25 2018

  • modernize codebase
  • drop initial windows support as i can't extend and maintain it

3.2.0 / Apr 21 2018

  • add deviceId and deviceIdSync methods

3.1.0 / Mar 24 2018

  • allow scan address range to be specified
  • update dependencies (nan v2.10.0)

3.0.0 / Feb 25 2018

  • update dependencies (nan v2.9.2)
  • fix deprecations
  • drop support for node.js v0.10, v0.12, v5 and v7

2.0.0 / Feb 11 2018

  • check parameters passed to api at api surface #42
  • update dependencies (async v2.6.0, lodash 4.17.5)

1.2.5 / Dec 24 2017

  • don't suppress deprecated-declaration warnings
  • update dependencies

1.2.4 / Nov 04 2017

  • suppress deprecated-declaration warnings
  • document node 9 support

1.2.3 / Oct 15 2017

  • update dependencies (bindings v1.3.0, nan v2.7.0)

1.2.2 / May 01 2017

  • update dependencies
  • document supported node versions
  • fix writeQuick argument check

1.2.1 / Feb 12 2017

  • documentation for forceAccess option improved
  • upgrade to nan v2.5.1

1.2.0 / Jan 06 2017

  • added forceAccess option which allows access to devices even if they are already in use by a driver
  • upgrade to nan v2.5.0, lodash v4.17.4 and async v2.1.4

1.1.2 / Oct 05 2016

  • allow scan and scanSync to continue scanning on all errors
  • upgrade to lodash v4.16.3 and async v2.0.1

1.1.1 / Jul 22 2016

  • examples SI1145-sync.js and two-devices-win.js added
  • nan 2.4.0, lodash 4.13.1, async 2.0.0

1.1.0 / May 23 2016

  • initial windows support

1.0.3 / Apr 27 2016

  • nan v2.3.2, lodash 4.11.1

1.0.2 / Jan 29 2016

  • nan 2.2.0, async 1.5.2, lodash 4.1.0

1.0.1 / Dec 05 2015

  • prevent Nan::ErrnoException related segmentation faults in v0.10.29

1.0.0 / Oct 10 2015

  • prevent leaking of fds for busy devices #13
  • refactored error objects #12
  • nan 2.1.0

0.12.0 / Oct 06 2015

  • added scan and scanSync #11
  • nan 2.0.9

0.11.3 / Sep 02 2015

  • nan1 to nan2 migration for iojs v3
  • documented configuration on edison arduino base board
  • documented configuration on the pi

0.11.2 / May 07 2015

  • io.js v2.0.0+ compatibility #7

0.11.1 / Mar 28 2015

  • Simplify concurrent asynchronous access to multiple devices #4
  • nan 1.7.0

0.11.0 / Feb 01 2015

  • added writeBlock and writeBlockSync - UNTESTED and undocumented due to lack of supporting hardware
  • added readBlock and readBlockSync - UNTESTED and undocumented due to lack of supporting hardware

0.10.0 / Jan 24 2015

  • added async example
  • strerror replaced with strerror_r
  • nan 1.5.3
  • added async access to multiple devices concurrently example

0.9.0 / Dec 22 2014

  • callback for writeI2cBlock now gets 3 arguments (err, bytesWritten, buffer)
  • added writeQuick and writeQuickSync
  • added example i2cquickscan to scan a bus for devices like 'i2cdetect -y -q 1'
  • fixed i2cscan example on the pi

0.8.0 / Dec 19 2014

  • added a plain i2c performance test
  • added i2cFuncs and i2cFuncsSync
  • added an example that does the same as command 'i2cdetect -F 1'
  • renamed readBytes to readI2cBlock
  • renamed readBytesSync to readI2cBlockSync
  • renamed writeBytes to writeI2cBlock
  • renamed writeBytesSync to writeI2cBlockSync
  • added an example that scans a bus for devices like 'i2cdetect -y -r 1'

0.7.0 / Dec 16 2014

  • faster compile
  • added plain i2cRead, i2cReadSync, i2cWrite, and i2cWriteSync methods

0.6.0 / Dec 15 2014

  • use __u8, __u16, and __s32 where appropriate
  • added brute force memory leak tests
  • added performance tests
  • added an example using two devices on the same bus
  • renamed all public api methods

0.5.0 / Dec 14 2014

  • added block operations

0.4.0 / Dec 13 2014

  • check for valid arguments in addon methods
  • added sync and async tests

0.3.0 / Dec 13 2014

  • improved example

0.2.0 / Dec 13 2014

  • corrected initial release date
  • use callbacks rather than events for asychronous open method
  • documentation
  • return this in synchronous write methods
  • added close and closeSync methods
  • added example

0.1.0 / Dec 09 2014

  • initial release