Created
November 10, 2019 16:27
-
-
Save rblaze/c2becb9863fa1c3fd37d7499ea826715 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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