Skip to content

Add soft reset function #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion qwiic_vl53l1x.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,27 @@ def init_sensor(self, address):



# VL53L1X_api_core.h functions
###############################################################################
###############################################################################

def soft_reset(self):
"""
This function causes the device to perform a soft reset
"""
self_status = 0

self.status = self.__i2cWrite(self.address, SOFT_RESET, 0, 1)
if (not self.status):
time.sleep(0.001)
if (not self.status):
self.status = self.__i2cWrite(self.address, SOFT_RESET, 1, 1)

return self.status




# VL53L1X_api.h functions
###############################################################################
###############################################################################
Expand Down Expand Up @@ -654,7 +675,7 @@ def sensor_init(self):
while(tmp == 0):
tmp = self.check_for_data_ready()
timeout = timeout + 1
if (timeout > 50):
if (timeout > 500):
self.status = VL53L1_ERROR_TIME_OUT
return self.status

Expand Down