1 Reply Latest reply on Dec 15, 2015 11:21 AM by EstebanC_Intel

    Trouble reading multiple bytes over I2C from a register using Javascript and MRAA


      I've been trying to read several (i.e. > 2) bytes from a given register of a device on a I2C channel.


      I know in C there is a call readBytesReg listed in the documentation (mraa: I2c Class Reference):

      readBytesReg (uint8_t reg, uint8_t *data, int length)

      but in the Javascript documentation (I2c), there is no equivalent listed.  In the debugger, I see the function attached to my I2C object

      but I'm not sure what the parameters are. I tried this:

      var buffer = this.i2cChannel.readBytesReg(register,numToRead) ;

      and I thought it was working but I'm having trouble with one call in which the numToRead parameter equals 3. I keep getting an "I2c write failed" message.

      Can anyone tell me if (1) this call does exist and works within the Javascript bindings and (2) is this the correct way to call it.