mirror of
https://github.com/whowechina/chu_pico.git
synced 2025-02-12 08:42:58 +01:00
Fix USB failure due to VL53L0x wait
This commit is contained in:
parent
505ac4e24c
commit
273d05d625
@ -773,16 +773,14 @@ void vl53l0x_stop_continuous()
|
|||||||
// single-shot range measurement)
|
// single-shot range measurement)
|
||||||
uint16_t readRangeContinuousMillimeters()
|
uint16_t readRangeContinuousMillimeters()
|
||||||
{
|
{
|
||||||
uint32_t start = time_us_32();
|
static uint16_t range = 65535;
|
||||||
while ((read_reg(RESULT_INTERRUPT_STATUS) & 0x07) == 0) {
|
if ((read_reg(RESULT_INTERRUPT_STATUS) & 0x07) == 0) {
|
||||||
if (time_us_32() - start > IO_TIMEOUT_US) {
|
return range; // use last result
|
||||||
return 65535;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// assumptions: Linearity Corrective Gain is 1000 (default);
|
// assumptions: Linearity Corrective Gain is 1000 (default);
|
||||||
// fractional ranging is not enabled
|
// fractional ranging is not enabled
|
||||||
uint16_t range = read_reg16(RESULT_RANGE_STATUS + 10);
|
range = read_reg16(RESULT_RANGE_STATUS + 10);
|
||||||
|
|
||||||
write_reg(SYSTEM_INTERRUPT_CLEAR, 0x01);
|
write_reg(SYSTEM_INTERRUPT_CLEAR, 0x01);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user