From 486928599dd43a973e1d6bd355d83d061149e945 Mon Sep 17 00:00:00 2001 From: Hongbo Miao Date: Thu, 18 Apr 2019 18:25:07 -0700 Subject: [PATCH] Use smbus2 [smbus2](https://github.com/kplindegaard/smbus2) is pure Python implementation of the python-smbus package. > Use the inherent i2c structs and unions to a greater extent than other pure Python implementations like pysmbus does. By doing so, it will be more feature complete and easier to extend. --- python/VL53L0X.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/VL53L0X.py b/python/VL53L0X.py index 07c35ab..795dfbb 100755 --- a/python/VL53L0X.py +++ b/python/VL53L0X.py @@ -24,7 +24,7 @@ import time from ctypes import * -import smbus +import smbus2 VL53L0X_GOOD_ACCURACY_MODE = 0 # Good Accuracy mode VL53L0X_BETTER_ACCURACY_MODE = 1 # Better Accuracy mode @@ -32,7 +32,7 @@ VL53L0X_LONG_RANGE_MODE = 3 # Longe Range mode VL53L0X_HIGH_SPEED_MODE = 4 # High Speed mode -i2cbus = smbus.SMBus(1) +i2cbus = smbus2.SMBus(1) # i2c bus read callback def i2c_read(address, reg, data_p, length):