Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ INCLUDES = \
-I$(ROOT_DIR)/platform/inc

PYTHON_INCLUDES = \
-I/usr/include/python2.7
-I/usr/include/python3.5

VPATH = \
$(API_DIR)/core/src \
Expand Down
16 changes: 10 additions & 6 deletions python/VL53L0X.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
def i2c_read(address, reg, data_p, length):
ret_val = 0;
result = []

try:
result = i2cbus.read_i2c_block_data(address, reg, length)
except IOError:
ret_val = -1;
ret_val = -1;

if (ret_val == 0):
for index in range(length):
Expand All @@ -57,10 +57,14 @@ def i2c_write(address, reg, data_p, length):

for index in range(length):
data.append(data_p[index])
try:
i2cbus.write_i2c_block_data(address, reg, data)
except IOError:
ret_val = -1;

if data:
try:
i2cbus.write_i2c_block_data(address, reg, data)
except IOError:
ret_val = -1;
except OverflowError:
ret_val = -1

return ret_val

Expand Down