Skip to content

Instantly share code, notes, and snippets.

@rblaze
Created November 10, 2019 16:27
Show Gist options
  • Save rblaze/c2becb9863fa1c3fd37d7499ea826715 to your computer and use it in GitHub Desktop.
Save rblaze/c2becb9863fa1c3fd37d7499ea826715 to your computer and use it in GitHub Desktop.
VL53L1X_ERROR VL53L1X_SensorInit(uint16_t dev)
{
VL53L1X_ERROR status = 0;
uint8_t Addr = 0x00, tmp;
for (Addr = 0x2D; Addr <= 0x87; Addr++){
status = VL53L1_WrByte(dev, Addr, VL51L1X_DEFAULT_CONFIGURATION[Addr - 0x2D]);
}
status = VL53L1X_StartRanging(dev);
tmp = 0;
while(tmp==0){
status = VL53L1X_CheckForDataReady(dev, &tmp);
}
status = VL53L1X_ClearInterrupt(dev);
status = VL53L1X_StopRanging(dev);
status = VL53L1_WrByte(dev, VL53L1_VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND, 0x09); /* two bounds VHV */
status = VL53L1_WrByte(dev, 0x0B, 0); /* start VHV from the previous temperature */
return status;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment