5 Replies Latest reply on Apr 22, 2016 3:17 AM by lyfkyle

    Array Storage Sequence when Reading Multiple Bytes

    lyfkyle

      I am trying to get multiple bytes from my sensor and I am not sure what is the correct sequence that Intel Edison use to store data to a buffer array.

      Specifically, I am trying to use this method to get data from Ublox gps module stored in address #0xFD and #0xFE:

       

      uint8_t buf [2];

      mraa_i2c_read_bytes_data(m_i2c, 0xFD, buf, 2); //this should give me data from address #0xFE as well because of auto-increment of address counter

       

      Now, the following code is from upm ADIS16448 library.

      Capture.PNG

      So this code suggests that the upper byte is stored inside buf[1] instead of buf[0]. Does that mean that in my case, the data from #0xFE is stored in buf[0] and data from #0xFD is stored in buf[1]? And What will happen if I declare buf size to be 3 for example?

      Thanks in advance