简体   繁体   中英

Why “fifoBuffer” values of indexes 2,3,6,7,10,11 are not passed in the teapotPacket[] array ?

I'm using the MPU6050 library by Jeff Rowberg. In the code, whole fifobuffer is not passed to the 'teapotPacket' array (for processing ,ie, graphics emulation). Why only certain indexes are passed in the 'teapotPacket' array ?(to be precise, only indexes given below are passed)

teapotPacket[2] = fifoBuffer[0];
teapotPacket[3] = fifoBuffer[1];
teapotPacket[4] = fifoBuffer[4];
teapotPacket[5] = fifoBuffer[5];
teapotPacket[6] = fifoBuffer[8];
teapotPacket[7] = fifoBuffer[9];
teapotPacket[8] = fifoBuffer[12];
teapotPacket[9] = fifoBuffer[13];

and please clarify one more thing, why the 'teapotPacket' array is initialized with the $ , hex numbers and '\\n' & '\\r' characters ?

uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' };

Duplicate of Question : Why “fifoBuffer” values of indexes 2,3,6,7,10,11 are not passed in the teapotPacket[] array?

Quoting my answer again here for completeness:

In the code, while passing data to the Teapot library(for processing,ie, graphics emulation), whole fifobuffer is not passed. Why is that so ?

Digging deeper into the library code, I found out that its just a "InvenSense Teapot demo" format for displaying the quaternion values.

Why the teapotPacket[14] array is initialised with these weird hex numbers ?

Its a packet structure format for InvenSense teapot, used for storing the sensor readings like quaternion values.

A little more information about : "Quaternion values" :

Quaternions is a number system that extends the complex numbers used for calculations involving three-dimensional rotations such as in three-dimensional computer graphics, computer vision, and crystallographic texture analysis.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM