/device/google/contexthub/firmware/src/drivers/ams_tmd4903/ |
D | ams_tmd4903.c | 218 static struct SensorData mTask; variable 261 osEnqueuePrivateEvt(EVT_SENSOR_PROX_INTERRUPT, NULL, NULL, mTask.tid); in proxIsr() 269 osEnqueuePrivateEvt(EVT_SENSOR_PROX_INTERRUPT, NULL, NULL, mTask.tid); in proxIsr() 273 osEnqueuePrivateEvt(EVT_SENSOR_ALS_INTERRUPT, NULL, NULL, mTask.tid); in proxIsr() 297 osEnqueuePrivateEvt(EVT_SENSOR_I2C, cookie, NULL, mTask.tid); in i2cCallback() 304 osEnqueuePrivateEvt(EVT_SENSOR_ALS_TIMER, cookie, NULL, mTask.tid); in alsTimerCallback() 321 …return LUX_PER_COUNTS * ((c * C_COEFF) + (r * R_COEFF) + (g * G_COEFF) + (b * B_COEFF)) * mTask.al… in getLuxFromAlsData() 367 mTask.txrxBuf[0] = AMS_TMD4903_REG_ENABLE; in setMode() 368 mTask.txrxBuf[1] = in setMode() 372 i2cMasterTx(I2C_BUS_ID, I2C_ADDR, mTask.txrxBuf, 2, &i2cCallback, cookie); in setMode() [all …]
|
/device/google/contexthub/firmware/src/drivers/orientation/ |
D | orientation.c | 144 static struct FusionTask mTask; variable 181 if (index == GYR && mTask.gyro_client_cnt == 0) { in fillSamples() 184 if (index == MAG && mTask.mag_client_cnt == 0) { in fillSamples() 188 n = mTask.sample_counts[index]; in fillSamples() 189 i = mTask.sample_indices[index]; in fillSamples() 190 counter = mTask.counters[index]; in fillSamples() 191 ResamplePeriodNs = mTask.ResamplePeriodNs[index]; in fillSamples() 192 w = (mTask.sample_indices[index] + n) % MAX_NUM_SAMPLES; in fillSamples() 195 if (mTask.last_time[index] == ULONG_LONG_MAX) { in fillSamples() 201 curr_sample = &mTask.last_sample[index]; in fillSamples() [all …]
|
/device/google/contexthub/firmware/src/drivers/bosch_bmp280/ |
D | bosch_bmp280.c | 99 } mTask; variable 148 osEnqueuePrivateEvt(EVT_SENSOR_I2C, cookie, NULL, mTask.id); in i2cCallback() 155 osEnqueuePrivateEvt(EVT_SENSOR_BARO_TIMER, cookie, NULL, mTask.id); in baroTimerCallback() 160 osEnqueuePrivateEvt(EVT_SENSOR_TEMP_TIMER, cookie, NULL, mTask.id); in tempTimerCallback() 165 mTask.txrxBuf[0] = BOSCH_BMP280_REG_CTRL_MEAS; in setMode() 166 mTask.txrxBuf[1] = (on) ? CTRL_ON : CTRL_SLEEP; in setMode() 167 i2cMasterTx(I2C_BUS_ID, I2C_ADDR, mTask.txrxBuf, 2, &i2cCallback, in setMode() 193 bool oldMode = mTask.baroOn || mTask.tempOn; in sensorPowerBaro() 194 bool newMode = on || mTask.tempOn; in sensorPowerBaro() 196 if (!on && mTask.baroTimerHandle) { in sensorPowerBaro() [all …]
|
/device/google/contexthub/firmware/src/drivers/rohm_rpr0521/ |
D | rohm_rpr0521.c | 217 static struct SensorData mTask; variable 245 osEnqueuePrivateEvt(EVT_SENSOR_PROX_INTERRUPT, NULL, NULL, mTask.tid); in proxIsr() 275 osEnqueuePrivateEvt(EVT_SENSOR_I2C, cookie, NULL, mTask.tid); in i2cCallback() 282 osEnqueuePrivateEvt(EVT_SENSOR_ALS_TIMER, cookie, NULL, mTask.tid); in alsTimerCallback() 322 mTask.txrxBuf[0] = ROHM_RPR0521_REG_MODE_CONTROL; in setMode() 323 …mTask.txrxBuf[1] = measurementTime[alsOn ? 1 : 0 + proxOn ? 2 : 0] | (alsOn ? ALS_EN_BIT : 0) | (p… in setMode() 324 i2cMasterTx(I2C_BUS_ID, I2C_ADDR, mTask.txrxBuf, 2, &i2cCallback, cookie); in setMode() 331 if (on && !mTask.alsTimerHandle) { in sensorPowerAls() 332 …mTask.alsTimerHandle = timTimerSet(ROHM_RPR0521_ALS_TIMER_DELAY, 0, 50, alsTimerCallback, NULL, fa… in sensorPowerAls() 333 } else if (!on && mTask.alsTimerHandle) { in sensorPowerAls() [all …]
|
/device/google/contexthub/firmware/src/drivers/bosch_bmi160/ |
D | bosch_bmi160.c | 496 static struct BMI160Task mTask; variable 511 SPI_READ(BMI160_REG_DATA_0, size, &mTask.dataBuffer); \ 543 #define TDECL() TASK = &mTask; (void)_task 604 time_sync_init(&mTask.gSensorTime2RTC); in time_init() 610 &mTask.gSensorTime2RTC, sensor_time * 39ull, rtc_time_ns); in sensortime_to_rtc_time() 615 time_sync_add(&mTask.gSensorTime2RTC, rtc_time_ns, sensor_time * 39ull); in map_sensortime_to_rtc_time() 619 time_sync_reset(&mTask.gSensorTime2RTC); in invalidate_sensortime_to_rtc_time() 625 time_sync_truncate(&mTask.gSensorTime2RTC, 2); in minimize_sensortime_history() 629 time_sync_hold(&mTask.gSensorTime2RTC, 2); in minimize_sensortime_history() 732 mTask.spiInUse = false; in sensorSpiCallback() [all …]
|
/device/google/contexthub/firmware/src/drivers/window_orientation/ |
D | window_orientation.c | 112 static struct WindowOrientationTask mTask; variable 185 if (now < mTask.predicted_rotation_time + PROPOSAL_SETTLE_TIME) { in isPredictedRotationAcceptable() 191 if (now < mTask.flat_time + PROPOSAL_MIN_TIME_SINCE_FLAT_ENDED) { in isPredictedRotationAcceptable() 197 if (now < mTask.swinging_time + PROPOSAL_MIN_TIME_SINCE_SWING_ENDED) { in isPredictedRotationAcceptable() 202 if (now < mTask.accelerating_time in isPredictedRotationAcceptable() 213 mTask.predicted_rotation = -1; in clearPredictedRotation() 214 mTask.predicted_rotation_time = 0; in clearPredictedRotation() 219 mTask.tilt_history_time[0] = 0; in clearTiltHistory() 220 mTask.tilt_history_index = 1; in clearTiltHistory() 221 mTask.tilt_reference_time = 0; in clearTiltHistory() [all …]
|
/device/google/contexthub/firmware/src/drivers/hall_twopole/ |
D | hall_twopole.c | 72 } mTask; variable 77 if (pinState != mTask.prevReportedState) { in hallReportState() 78 mTask.prevReportedState = pinState; in hallReportState() 87 int32_t currPinState = MAKE_TYPE(gpioGet(mTask.sPin), gpioGet(mTask.nPin)); in debounceTimerCallback() 89 if (mTask.on && (currPinState == prevPinState)) { in debounceTimerCallback() 156 extiClearPendingGpio(mTask.sPin); in hallPower() 157 extiClearPendingGpio(mTask.nPin); in hallPower() 158 enableInterrupt(mTask.sPin, &mTask.sIsr, HALL_S_IRQ); in hallPower() 159 enableInterrupt(mTask.nPin, &mTask.nIsr, HALL_N_IRQ); in hallPower() 161 disableInterrupt(mTask.sPin, &mTask.sIsr, HALL_S_IRQ); in hallPower() [all …]
|
/device/google/contexthub/firmware/src/drivers/hall/ |
D | hall.c | 62 } mTask; variable 68 bool pinState = gpioGet(mTask.pin); in debounceTimerCallback() 70 if (mTask.on) { in debounceTimerCallback() 75 if (sample.idata != mTask.prevReportedValue) { in debounceTimerCallback() 76 mTask.prevReportedValue = sample.idata; in debounceTimerCallback() 93 if (mTask.debounceTimerHandle) in hallIsr() 94 timTimerCancel(mTask.debounceTimerHandle); in hallIsr() 96 …mTask.debounceTimerHandle = timTimerSet(HALL_DEBOUNCE_TIMER_DELAY, 0, 50, debounceTimerCallback, (… in hallIsr() 139 extiClearPendingGpio(mTask.pin); in hallPower() 140 enableInterrupt(mTask.pin, &mTask.isr); in hallPower() [all …]
|
/device/google/contexthub/firmware/src/drivers/tilt_detection/ |
D | tilt_detection.c | 65 } mTask; variable 80 struct TiltAlgoState *state = &mTask.algoState; in algoUpdate() 145 sensorRequest(mTask.taskId, mTask.anyMotionHandle, SENSOR_RATE_ONCHANGE, 0); in configAnyMotion() 146 osEventSubscribe(mTask.taskId, EVT_SENSOR_ANY_MOTION); in configAnyMotion() 148 sensorRelease(mTask.taskId, mTask.anyMotionHandle); in configAnyMotion() 149 osEventUnsubscribe(mTask.taskId, EVT_SENSOR_ANY_MOTION); in configAnyMotion() 155 sensorRequest(mTask.taskId, mTask.noMotionHandle, SENSOR_RATE_ONCHANGE, 0); in configNoMotion() 156 osEventSubscribe(mTask.taskId, EVT_SENSOR_NO_MOTION); in configNoMotion() 158 sensorRelease(mTask.taskId, mTask.noMotionHandle); in configNoMotion() 159 osEventUnsubscribe(mTask.taskId, EVT_SENSOR_NO_MOTION); in configNoMotion() [all …]
|
/device/google/contexthub/firmware/src/drivers/vsync/ |
D | vsync.c | 67 } mTask; variable 117 extiClearPendingGpio(mTask.pin); in vsyncPower() 118 enableInterrupt(mTask.pin, &mTask.isr); in vsyncPower() 120 disableInterrupt(mTask.pin, &mTask.isr); in vsyncPower() 121 extiClearPendingGpio(mTask.pin); in vsyncPower() 124 mTask.on = on; in vsyncPower() 125 sensorSignalInternalEvt(mTask.sensorHandle, SENSOR_INTERNAL_EVT_POWER_STATE_CHG, on, 0); in vsyncPower() 131 return sensorSignalInternalEvt(mTask.sensorHandle, SENSOR_INTERNAL_EVT_FW_STATE_CHG, 1, 0); in vsyncFirmwareUpload() 137 return sensorSignalInternalEvt(mTask.sensorHandle, SENSOR_INTERNAL_EVT_RATE_CHG, rate, latency); in vsyncSetRate() 162 mTask.id = taskId; in startTask() [all …]
|