1 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
3 # SPDX-License-Identifier: MIT
4 """I2C Class for MCP2221"""
6 from .fake_mcp2221 import mcp2221
10 """Custom I2C Class for MCP2221"""
12 def __init__(self, *, frequency=100000):
13 self._mcp2221 = mcp2221
14 self._freq = frequency
16 # pylint: disable=no-self-use
18 def scan(self, address_list=None):
20 If address_list is not provided, this function returns a
21 list of 3 randomly generated I2C addresses from 0x0 to 0x79.
22 For a stimulus-driven test: If address_list is provided,
23 this function returns the provided address_list.
25 if address_list is None:
26 # Generate a list of 3 randomly generated addresses from 0x0 to 0x79
29 address_list.append(random.randint(0x0, 0x79))