When I read 6 bytes of accelerometer data in a burst starting from address X_OUT_H the bytes come in the right order. However when I read 6 bytes in a burst starting from FIFO_R_W the bytes are completely mixed up. What is wrong?
spi_read_reg(0x74,6) // read 6 bytes from fifo
local x = data[0]<<8|data[1] // left shift high byte and OR with low bye
local y = data[2]<<8|data[3] // left shift high byte and OR with low bye
local z = data[4]<<8|data[5] // left shift high byte and OR with low bye
if(x&0x8000){x=-((~x&0x7fff)+1)} // to convert two's complement to a float
if(y&0x8000){y=-((~y&0x7fff)+1)} // if the bit15 is set
if(z&0x8000){z=-((~z&0x7fff)+1)} // invert the bits and add 1
x=x*61e-6 // each digit is 4g/2^16=61ug
y=y*61e-6 // each digit is 4g/2^16=61ug
z=z*61e-6 // each digit is 4g/2^16=61ug
server.log(format("X:%0.6fg, Y: %0.6fg, Z: %0.6fg",x,y,z))Actually I wan to read 16 XYZ accelerometer samples in a burst, so i want to do a 96 bytes read burst. is that possible?