Lines Matching full:fifo_obj
129 struct fifo_obj {
146 static struct fifo_obj fifo_obj;
172 accuracy = fifo_obj.data_config[configOffset];
174 if ((fifo_obj.data_config[configOffset] & INV_32_BIT))
202 && (fifo_obj.reference_count[kk + refOffset] > 0)) {
203 fifo_obj.reference_count[kk + refOffset]--;
210 fifo_obj.reference_count[kk + refOffset]++;
216 if (fifo_obj.reference_count[kk + refOffset] > 0)
243 fifo_obj.data_config[configOffset] = elements | accuracy;
267 int *fifo_offsets_ptr = fifo_obj.offsets;
269 fifo_obj.fifo_packet_size = 0;
274 if ((fifo_obj.data_config[i] >> j) & 0x0001) {
326 if (fifo_obj.data_config[i] & INV_32_BIT) {
384 if (fifo_obj.data_config[i] & INV_32_BIT) {
395 fifo_obj.fifo_packet_size += tmp_count;
397 if (fifo_obj.data_config[CONFIG_FOOTER] == 0 &&
398 fifo_obj.fifo_packet_size > 0) {
405 fifo_obj.data_config[CONFIG_FOOTER] = 0x0001 | INV_16_BIT;
406 fifo_obj.fifo_packet_size += 2;
407 } else if (fifo_obj.data_config[CONFIG_FOOTER] &&
408 (fifo_obj.fifo_packet_size == 2)) {
416 fifo_obj.data_config[CONFIG_FOOTER] = 0;
417 fifo_obj.fifo_packet_size = 0;
428 if (!fifo_obj.data_config[CONFIG_DMP_QUANT_ACCEL])
443 value.u32 = fifo_obj.decoded[REF_QUANT_ACCEL + kk];
449 fifo_obj.decoded_accel[kk][2] = temp.s10 * 64;
454 fifo_obj.decoded_accel[kk][1] = temp.s10 * 64;
458 fifo_obj
487 tmp = (0x20000000L * M_PI) / (fifo_obj.fifo_rate + 1);
513 return fifo_obj.fifo_packet_size;
526 memset(&fifo_obj, 0, sizeof(struct fifo_obj));
527 fifo_obj.decoded[REF_QUATERNION] = 1073741824L; // Set to Identity
529 fifo_obj.fifo_rate = 20;
530 fifo_obj.sample_step_size_ms = 100;
576 fifo_obj.gyro_source = source;
605 if (fifo_obj.fifo_packet_size == 0)
612 read = inv_get_fifo((uint_fast16_t) fifo_obj.fifo_packet_size,
615 read != fifo_obj.fifo_packet_size - FIFO_FOOTER_SIZE) {
618 memset(fifo_obj.decoded, 0, sizeof(fifo_obj.decoded));
639 memset(fifo_obj.decoded, 0, sizeof(fifo_obj.decoded));
640 fifo_obj.cache = 0;
642 fifo_obj.decoded[REF_RAW + 4 + kk] =
645 fifo_obj.decoded[REF_ACCEL + kk] =
647 fifo_obj.decoded[REF_ACCEL + kk] -=
655 if ((fifo_obj.fifo_rate < INV_MAX_NUM_ACCEL_SAMPLES) &&
656 fifo_obj.data_config[CONFIG_DMP_QUANT_ACCEL]) {
664 if (fifo_obj.data_config[CONFIG_QUAT]) {
715 fifo_obj.fifo_process_cb = func;
736 p = (unsigned char *)(&fifo_obj.decoded);
737 N = fifo_obj.fifo_packet_size;
738 if (N > sizeof(fifo_obj.decoded))
741 memset(&fifo_obj.decoded, 0, sizeof(fifo_obj.decoded));
744 p[fifo_obj.offsets[kk]] = *dmpData++;
750 fifo_obj.decoded[kk] =
751 inv_q30_mult(fifo_obj.decoded[kk], fifo_scale[kk]);
754 memcpy(&fifo_obj.decoded[REF_QUATERNION_6AXIS],
755 &fifo_obj.decoded[REF_QUATERNION], 4 * sizeof(long));
758 fifo_obj.cache = 0;
790 if (!fifo_obj.data_config[CONFIG_TEMPERATURE]) {
793 if ((fifo_obj.cache & FIFO_CACHE_TEMPERATURE) == 0) {
796 fifo_obj.cache |= FIFO_CACHE_TEMPERATURE;
804 fifo_obj.decoded[REF_RAW] = ((short)regs[0] << 8) | (regs[1]);
807 *data = (short)fifo_obj.decoded[REF_RAW];
845 if (!fifo_obj.data_config[CONFIG_DMP_QUANT_ACCEL])
850 data[ii * ACCEL_NUM_AXES + kk] = fifo_obj.decoded_accel[ii][kk];
869 if (!fifo_obj.data_config[CONFIG_DMP_QUANT_ACCEL])
873 data[ii] = fifo_obj.decoded[REF_QUANT_ACCEL + ii];
888 if ((fifo_obj.data_config[CONFIG_RAW_DATA] & 7) != 7) {
891 if ((fifo_obj.cache & FIFO_CACHE_GYRO) == 0) {
892 fifo_obj.cache |= FIFO_CACHE_GYRO;
901 fifo_obj.decoded[REF_RAW + 1] =
903 fifo_obj.decoded[REF_RAW + 2] =
905 fifo_obj.decoded[REF_RAW + 3] =
909 fifo_obj.decoded[REF_RAW + 1] =
910 inv_q30_mult(fifo_obj.decoded[REF_RAW + 1],
912 fifo_obj.decoded[REF_RAW + 2] =
913 inv_q30_mult(fifo_obj.decoded[REF_RAW + 2],
915 fifo_obj.decoded[REF_RAW + 3] =
916 inv_q30_mult(fifo_obj.decoded[REF_RAW + 3],
919 data[0] = fifo_obj.decoded[REF_RAW + 1];
920 data[1] = fifo_obj.decoded[REF_RAW + 2];
921 data[2] = fifo_obj.decoded[REF_RAW + 3];
943 if (!fifo_obj.data_config[CONFIG_RAW_DATA])
947 data[ii] = fifo_obj.decoded[REF_RAW + 1 + ii];
966 if (!fifo_obj.data_config[CONFIG_RAW_EXTERNAL])
970 data[ii] = fifo_obj.decoded[REF_RAW_EXTERNAL + ii];
1041 fifo_obj.data_config[CONFIG_CONTROL_DATA] = elements | accuracy;
1088 fifo_obj.data_config[CONFIG_DMP_PACKET_NUMBER] =
1092 fifo_obj.data_config[CONFIG_DMP_PACKET_NUMBER] = 0;
1153 if (fifo_obj.gyro_source == INV_GYRO_FROM_QUATERNION) {
1271 fifo_obj.data_config[CONFIG_QUAT] = elements | accuracy;
1317 fifo_obj.data_config[CONFIG_TEMPERATURE] = 1 | INV_16_BIT;
1319 fifo_obj.data_config[CONFIG_TEMPERATURE] = 0;
1321 fifo_obj.data_config[CONFIG_RAW_DATA] =
1324 fifo_obj.data_config[CONFIG_RAW_DATA] = 0;
1395 fifo_obj.data_config[CONFIG_TEMPERATURE] = 1 | INV_16_BIT;
1397 fifo_obj.data_config[CONFIG_TEMPERATURE] = 0;
1399 fifo_obj.data_config[CONFIG_RAW_DATA] =
1402 fifo_obj.data_config[CONFIG_RAW_DATA] = 0;
1436 fifo_obj.data_config[CONFIG_RAW_EXTERNAL] = elements | INV_16_BIT;
1438 fifo_obj.data_config[CONFIG_RAW_EXTERNAL] = 0;
1510 fifo_obj.data_config[CONFIG_DMP_QUANT_ACCEL] = (elements) | INV_32_BIT;
1512 fifo_obj.data_config[CONFIG_DMP_QUANT_ACCEL] = 0;
1516 fifo_obj.decoded[REF_QUANT_ACCEL + kk] = 0;
1518 fifo_obj.decoded_accel[kk][ii] = 0;
1566 fifo_obj.data_config[CONFIG_EIS] = elements | accuracy;
1594 if ((!fifo_obj.data_config[CONFIG_ACCEL] &&
1602 data[kk] = fifo_obj.decoded[REF_ACCEL + kk];
1623 if (!fifo_obj.data_config[CONFIG_QUAT])
1627 data[kk] = fifo_obj.decoded[REF_QUATERNION + kk];
1646 if (!fifo_obj.data_config[CONFIG_QUAT])
1650 data[kk] = fifo_obj.decoded[REF_QUATERNION_6AXIS + kk];
1680 if (fifo_obj.data_config[CONFIG_GYROS]) {
1682 data[kk] = fifo_obj.decoded[REF_GYROS + kk];
1706 if (!fifo_obj.data_config[CONFIG_QUAT])
1709 if ((fifo_obj.cache & FIFO_CACHE_GRAVITY_BODY) == 0) {
1710 fifo_obj.cache |= FIFO_CACHE_GRAVITY_BODY;
1729 fifo_obj.gravity_cache[ii] = data[ii];
1732 data[0] = fifo_obj.gravity_cache[0];
1733 data[1] = fifo_obj.gravity_cache[1];
1734 data[2] = fifo_obj.gravity_cache[2];
1749 fifo_obj.acc_filter_coef = coef;
1781 if ((fifo_obj.cache & FIFO_CACHE_ACC_BIAS) == 0) {
1782 fifo_obj.cache |= FIFO_CACHE_ACC_BIAS;
1787 fifo_obj.acc_bias_filt[kk] = (long)(x * fifo_obj.acc_filter_coef +
1788 fifo_obj.acc_bias_filt[kk] *
1790 fifo_obj.acc_filter_coef));
1791 data[kk] = x - fifo_obj.acc_bias_filt[kk];
1795 data[kk] = la[kk] - grav[kk] - fifo_obj.acc_bias_filt[kk];
1813 if (fifo_obj.data_config[CONFIG_ACCEL] && fifo_obj.data_config[CONFIG_QUAT]) {
1817 inv_q_mult(&fifo_obj.decoded[REF_QUATERNION], wtemp, wtemp2);
1818 inv_q_invert(&fifo_obj.decoded[REF_QUATERNION], qi);
1840 if (!fifo_obj.data_config[CONFIG_CONTROL_DATA])
1844 data[kk] = fifo_obj.decoded[REF_CONTROL + kk];
1862 if (!fifo_obj.data_config[CONFIG_EIS])
1866 data[kk] = fifo_obj.decoded[REF_EIS + kk];
1912 if (!fifo_obj.data_config[CONFIG_QUAT])
1916 data[kk] = fifo_obj.decoded[REF_QUATERNION + kk] / 1073741824.0f;
1967 fifo_obj.fifo_rate = fifoRate;
1979 fifo_obj.sample_step_size_ms =
2013 fifo_obj.sample_step_size_ms = (unsigned short)((1000L * 1000L) / data);
2029 return fifo_obj.fifo_rate;
2045 return (fifo_obj.fifo_rate + 1) *
2048 fifo_obj.sample_step_size_ms;
2065 (fifo_obj.fifo_rate + 1));
2067 return (1000 / fifo_obj.sample_step_size_ms);
2082 temp = fifo_obj.decoded[REF_GYROS + kk] >>
2122 fifo_obj.decoded[REF_QUATERNION + kk] = (long)(q[kk] * (1L << 30));
2245 if (fifo_obj.fifo_process_cb)
2246 fifo_obj.fifo_process_cb();