Lines Matching refs:ACC
252 ACC = FIRST_CONT_SENSOR,
430 struct accelCal_t acc;
848 sensorSignalInternalEvt(mTask.sensors[ACC].handle,
1092 bool anyFifoEnabled = mTask.fifo_enabled[ACC] || mTask.fifo_enabled[GYR];
1113 // if ACC is configed, enable ACC bit in fifo_config reg.
1114 if (mTask.sensors[ACC].configed && mTask.sensors[ACC].latency != SENSOR_LATENCY_NODATA) {
1116 mTask.fifo_enabled[ACC] = true;
1118 mTask.fifo_enabled[ACC] = false;
1123 accelCalNewBiasAvailable = accelCalUpdateBias(&mTask.acc, &accelCalBiasX, &accelCalBiasY, &accelCalBiasZ);
1125 mSensorAcc = &mTask.sensors[ACC];
1132 EVENT_TYPE_BIT_DISCARDABLE | sensorGetMyEventType(mSensorInfo[ACC].sensorType));
1149 flushData(mSensorAcc, sensorGetMyEventType(mSensorInfo[ACC].biasType));
1225 // set ACC power mode to NORMAL
1228 // set ACC power mode to SUSPEND
1229 mTask.sensors[ACC].configed = false;
1233 mTask.sensors[ACC].powered = on;
1234 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
1236 mTask.pending_config[ACC] = true;
1237 mTask.sensors[ACC].pConfig.enable = on;
1505 ERROR_PRINT("invalid acc rate\n");
1509 updateTimeDelta(ACC, odr);
1525 mTask.sensors[ACC].rate = rate;
1526 mTask.sensors[ACC].latency = latency;
1527 mTask.sensors[ACC].configed = true;
1533 // set ACC bandwidth parameter to 2 (bits[4:6])
1544 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
1546 mTask.pending_config[ACC] = true;
1547 mTask.sensors[ACC].pConfig.enable = 1;
1548 mTask.sensors[ACC].pConfig.rate = rate;
1549 mTask.sensors[ACC].pConfig.latency = latency;
1737 while (mTask.sensors[ACC].flush > 0) {
1739 mTask.sensors[ACC].flush--;
1756 mTask.sensors[ACC].flush++;
1966 if (mSensor->idx == ACC) {
1969 accelCalRun(&mTask.acc, rtc_time,
1972 accelCalBiasRemove(&mTask.acc, &x, &y, &z);
2347 parseRawData(&mTask.sensors[ACC], &buf[i], kScale_acc, tmp_frame_time);
2349 if (mTask.prev_frame_time[ACC] == ULONG_LONG_MAX) {
2350 DEBUG_PRINT("acc enabled: frame %d time 0x%08x\n",
2352 } else if ((tmp_frame_time != tmp_time[ACC]) && (tmp_time[ACC] != 0)) {
2355 (unsigned int)tmp_time[ACC],
2357 (int)(5 * ((int64_t)(tmp_frame_time - tmp_time[ACC]) >> 7)));
2361 mTask.prev_frame_time[ACC] = tmp_frame_time;
2364 observed[ACC] = true;
2370 if (observed[ACC] || observed[GYR])
2464 if (mTask.sensors[ACC].offset_enable)
2477 if (mTask.sensors[ACC].offset_enable) {
2478 SPI_WRITE(BMI160_REG_OFFSET_0, mTask.sensors[ACC].offset[0] & 0xFF, 450);
2479 SPI_WRITE(BMI160_REG_OFFSET_0 + 1, mTask.sensors[ACC].offset[1] & 0xFF, 450);
2480 SPI_WRITE(BMI160_REG_OFFSET_0 + 2, mTask.sensors[ACC].offset[2] & 0xFF, 450);
2526 // turn ACC to NORMAL mode
2530 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
2548 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
2569 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
2578 mTask.sensors[ACC].offset[0] = mTask.dataBuffer[1];
2579 mTask.sensors[ACC].offset[1] = mTask.dataBuffer[2];
2580 mTask.sensors[ACC].offset[2] = mTask.dataBuffer[3];
2582 if (mTask.sensors[ACC].offset[0] & 0x80)
2583 mTask.sensors[ACC].offset[0] |= 0xFFFFFF00;
2584 if (mTask.sensors[ACC].offset[1] & 0x80)
2585 mTask.sensors[ACC].offset[1] |= 0xFFFFFF00;
2586 if (mTask.sensors[ACC].offset[2] & 0x80)
2587 mTask.sensors[ACC].offset[2] |= 0xFFFFFF00;
2589 mTask.sensors[ACC].offset_enable = true;
2591 (unsigned int)mTask.sensors[ACC].offset[0],
2592 (unsigned int)mTask.sensors[ACC].offset[1],
2593 (unsigned int)mTask.sensors[ACC].offset[2]);
2596 mTask.sensors[ACC].offset[0], mTask.sensors[ACC].offset[1],
2597 mTask.sensors[ACC].offset[2]);
2603 // turn ACC to SUSPEND mode
2607 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
2618 if (!mTask.sensors[ACC].powered && trySwitchState(SENSOR_CALIBRATING)) {
2637 mTask.sensors[ACC].offset[0] = values->hw[0];
2638 mTask.sensors[ACC].offset[1] = values->hw[1];
2639 mTask.sensors[ACC].offset[2] = values->hw[2];
2640 mTask.sensors[ACC].offset_enable = true;
2643 accelCalBiasSet(&mTask.acc, values->sw[0], values->sw[1], values->sw[2]);
2687 // turn ACC to NORMAL mode
2691 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
2705 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
2717 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
2734 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
2757 // turn ACC to SUSPEND mode
2761 spiBatchTxRx(&mTask.mode, sensorSpiCallback, &mTask.sensors[ACC], __FUNCTION__);
2775 if (!mTask.sensors[ACC].powered && trySwitchState(SENSOR_TESTING)) {
3166 mTask.sensors[ACC].offset_enable = false;
3300 sensorRequest(mTask.tid, mTask.sensors[ACC].handle, SENSOR_HZ(50), SENSOR_LATENCY_NODATA);
3311 sensorRelease(mTask.tid, mTask.sensors[ACC].handle);
3351 (mSensor->idx == ACC) ? SENS_TYPE_ACCEL : SENS_TYPE_GYRO, 0, 0, 0);
3353 } else if (mSensor->idx == ACC) {
3361 if (mSensor->idx == ACC) {
3527 accelCalInit(&mTask.acc,
3604 accelCalDestroy(&mTask.acc);
3696 DEBUG_PRINT_IF(DBG_SHALLOW_PARSE, "at %d, a reg frame acc %d, gyro %d, mag %d\n",
3873 period[i - ACC] = SENSOR_HZ((float)WATERMARK_MAX_SENSOR_RATE) / T(sensors[i]).rate;
3874 latency[i - ACC] = U64_DIV_BY_U64_CONSTANT(
3879 period[i-ACC], latency[i-ACC]);