2025-01-20 08:24 AM - last edited on 2025-01-20 09:46 AM by Peter BENSCH
We are beginning to migrate from the L1 to the L4.
Wondering if there is a way to auto-detect which sensor is on the board? I would like to build one fw version which abstracts away which sensor is in use (albeit taking advantage of diff features) but all I see is SWVersion API which only returns version not type. Both appear to be same address on I2C for us.
Thanks,
Will
Solved! Go to Solution.
2025-01-20 08:39 AM
Both those chips should have a model ID at the same location
VL53L1X_ERROR VL53L1X_GetSensorId(VL53L1_Dev_t dev, uint16_t *sensorId)
{
VL53L1X_ERROR status = 0;
uint16_t tmp = 0;
status = VL53L1_RdWord(&dev, VL53L1_IDENTIFICATION__MODEL_ID, &tmp);
*sensorId = tmp;
return status;
}
I can't remember which one is which, but it should be easy enough to test.
- john
2025-01-20 08:39 AM
Both those chips should have a model ID at the same location
VL53L1X_ERROR VL53L1X_GetSensorId(VL53L1_Dev_t dev, uint16_t *sensorId)
{
VL53L1X_ERROR status = 0;
uint16_t tmp = 0;
status = VL53L1_RdWord(&dev, VL53L1_IDENTIFICATION__MODEL_ID, &tmp);
*sensorId = tmp;
return status;
}
I can't remember which one is which, but it should be easy enough to test.
- john
2025-01-20 09:31 AM
Perfect! Thank you!