File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 6666from .i2c_driver import I2CDriver
6767
6868# All supported platform module and class names
69- sub_modules = ["linux_i2c" , "circuitpy_i2c" , "micropython_i2c" ]
70- class_names = ["LinuxI2C" , "CircuitPythonI2C" , "MicroPythonI2C" ]
69+ _supported_platforms = {
70+ "linux_i2c" : "LinuxI2C" ,
71+ "circuitpy_i2c" : "CircuitPythonI2C" ,
72+ "micropython_i2c" : "MicroPythonI2C"
73+ }
7174
7275# List of platform drivers found on this system
7376_drivers = []
7477
7578# Loop through all supported platform drivers, see if they're included, and
7679# append them to the driver list if so
77- for i in range ( len ( sub_modules ) ):
80+ for module_name , class_name in _supported_platforms . items ( ):
7881 try :
79- full_name = "qwiic_i2c." + sub_modules [i ]
80- sub_module = __import__ (full_name , None , None , [None ])
81- _drivers .append (getattr (sub_module , class_names [i ]))
82+ sub_module = __import__ ("qwiic_i2c." + module_name , None , None , [None ])
83+ _drivers .append (getattr (sub_module , class_name ))
8284 except :
8385 pass
8486
You can’t perform that action at this time.
0 commit comments