node-i2c icon indicating copy to clipboard operation
node-i2c copied to clipboard

feat: add readbytedata method

Open matheussampaio opened this issue 7 years ago • 1 comments

Creating interface for i2c_smbus_read_byte_data(file, position).

Example (read EDID data):

const i2c = new I2C(0x50, { device: '/dev/i2c-1' }, async (error) => {
    if (error) {
        return console.error(error);
    }

    i2c.readByteDataAsync = util.promisify(i2c.readByteData);

    const edid = [];

    for (let i = 0; i < 256; i++) {
        const byte = await i2c.readByteDataAsync(i);

        edid.push(byte);
    }

    return console.log(edid);
});

matheussampaio avatar Jul 13 '17 13:07 matheussampaio

May I suggest to consider to forward to abandonware fork

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

rzr avatar Jan 13 '20 16:01 rzr