You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reading the sensor like this is leaves much more time for other stuff. Checking for data takes about 120 us and reading takes 230us on a tennsy 3.2. The original way takes around 20 ms. Using the interrupt pin makes checking even faster:). I measured this with the Wire clock at 400000.
The text was updated successfully, but these errors were encountered:
Sorry, I don't yet know hot to make a pull request but i thought this might be useful to others.
In the cpp file init method change line 239 to:
writeReg(GPIO_HV_MUX_ACTIVE_HIGH, readReg(GPIO_HV_MUX_ACTIVE_HIGH) & 0xEF);
this will make the GPIO pin go low when a measurement is done.
I would also add this two methods (maybe you have a better name for the second one) which splits the continuous read in two parts.
bool VL53L0X::dataAvailable(void)
{
if((readReg(RESULT_INTERRUPT_STATUS) & 0x07) == 0)
return false;
else return true;
}
uint16_t VL53L0X::readRangeDataContinuous(void)
{
uint16_t range = readReg16Bit(RESULT_RANGE_STATUS + 10);
writeReg(SYSTEM_INTERRUPT_CLEAR, 0x01);
return range;
}
You can use it like so:
if(sensor.dataAvailable())
{
Serial.println(sensor.readRangeDataContinuous());
}
Reading the sensor like this is leaves much more time for other stuff. Checking for data takes about 120 us and reading takes 230us on a tennsy 3.2. The original way takes around 20 ms. Using the interrupt pin makes checking even faster:). I measured this with the Wire clock at 400000.
The text was updated successfully, but these errors were encountered: