|
通过在地址0x14读取12个字节数据
Status = VL53L0X_ReadMulti(Dev, 0x14, localBuffer, 12);
将读取的数据转换成tmpuint16、SignalRate、AmbientRate
tmpuint16、SignalRate、AmbientRate
这三个数据会随物体的距离变化而变化
看到官方例程里tmpuint16需要判断LinearityCorrectiveGain再和LinearityCorrectiveGain计算
没看懂LinearityCorrectiveGain是怎么得到的,
LinearityCorrectiveGain = PALDevDataGet(Dev,
LinearityCorrectiveGain);
PALDevDataGet函数相当于调用Dev->Data.LinearityCorrectiveGain
可是LinearityCorrectiveGain是在哪设置的呢?
- tmpuint16 = VL53L0X_MAKEUINT16(localBuffer[11], localBuffer[10]);
- /* cut1.1 if SYSTEM__RANGE_CONFIG if 1 range is 2bits fractional
- *(format 11.2) else no fractional
- */
- pRangingMeasurementData->MeasurementTimeUsec = 0;
- SignalRate = VL53L0X_FIXPOINT97TOFIXPOINT1616(
- VL53L0X_MAKEUINT16(localBuffer[7], localBuffer[6]));
- /* peak_signal_count_rate_rtn_mcps */
- pRangingMeasurementData->SignalRateRtnMegaCps = SignalRate;
- AmbientRate = VL53L0X_MAKEUINT16(localBuffer[9], localBuffer[8]);
- pRangingMeasurementData->AmbientRateRtnMegaCps =
- VL53L0X_FIXPOINT97TOFIXPOINT1616(AmbientRate);
复制代码
|
|