In our API, is the function.
VL53L4CD_Error VL53L4CD_SetDetectionThresholds(
Dev_t dev,
uint16_t distance_low_mm,
uint16_t distance_high_mm,
uint8_t window)
{
VL53L4CD_Error status = VL53L4CD_ERROR_NONE;
status |= VL53L4CD_WrByte(dev, VL53L4CD_SYSTEM__INTERRUPT, window);
status |= VL53L4CD_WrWord(dev, VL53L4CD_THRESH_HIGH, distance_high_mm);
status |= VL53L4CD_WrWord(dev, VL53L4CD_THRESH_LOW, distance_low_mm);
return status;
}
Just call that.
Trouble is that window is not very well defined. What you want is an interrupt when something goes away.
So set your thresholds to some value a good distance above and below where you expect your target to be. Then set the window to 2. Out of window. When your target goes away, you should get the interrupt.
In my experiments it works.
However, note that you will get one interrupt at start.
(it appears i got the register definition in my first reply from the wrong sensor. I'll remove that.)
- john
- john
If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.