This message was posted on behalf of Intel Corporation
There's something I don't understand about your question. You mention that you need to understand how buffers are "filled" and you mention the mraa command to read I2C bytes but then you post a section of the ADIS16448 library which works with SPI.
Nevertheless, the way the bytes "enter" in the ADIS16448 library is not through buf, but instead they are received through x and then ordered into _dataOut which is what's returned.
I am sorry for the confusion in my code, The code of ADIS16448 suggests that the x stores the upper byte while x stores the lower byte. So I assume that in my case, if I run mraa_i2c_read_bytes_data(m_i2c, 0xFD, buf, 2), buf stores data from #0xFD and buf stores data from #0xFE, I am just asking to confirm my speculation.
Thank you very much.
I am posting this as clarification as I finally realized what caused me the confusion.
I have recently discovered that ADIS16448 actually stores upper byte at an address higher than the address of the lower byte. That is the reason why buf contains upper byte while buff contains the lower byte. So if I run the mraa_i2c_read on another device which stores the data in its registers using the reverse order, the data I get in my buffer will be in reverse order as well.