+class MCP2221I2C(_MCP2221I2C): # pylint: disable=too-few-public-methods
+ def __init__(self, mcp2221, *, frequency=100000):
+ self._mcp2221 = mcp2221
+ self._mcp2221.i2c_configure(frequency)
+
+
+class I2C(busio.I2C): # pylint: disable=too-few-public-methods
+ def __init__(self, mcp2221_i2c):
+ self._i2c = mcp2221_i2c
+
+
+addresses = [mcp["path"] for mcp in hid.enumerate(0x04D8, 0x00DD)]
+
+i2c_devices = []
+i2c_devices.append(I2C(MCP2221I2C(_mcp2221)))
+
+for addr in addresses:
+ try:
+ i2c_device = I2C(MCP2221I2C(MCP2221(addr)))
+ i2c_devices.append(i2c_device)
+ except OSError:
+ print("Device path: " + str(addr) + " is used")