mirror of
https://github.com/whowechina/chu_pico.git
synced 2025-01-31 12:03:43 +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)
|
||||
uint16_t readRangeContinuousMillimeters()
|
||||
{
|
||||
uint32_t start = time_us_32();
|
||||
while ((read_reg(RESULT_INTERRUPT_STATUS) & 0x07) == 0) {
|
||||
if (time_us_32() - start > IO_TIMEOUT_US) {
|
||||
return 65535;
|
||||
}
|
||||
static uint16_t range = 65535;
|
||||
if ((read_reg(RESULT_INTERRUPT_STATUS) & 0x07) == 0) {
|
||||
return range; // use last result
|
||||
}
|
||||
|
||||
// assumptions: Linearity Corrective Gain is 1000 (default);
|
||||
// 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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user