1 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
3 # SPDX-License-Identifier: MIT
4 """I2C Class for MCP2221"""
5 from .fake_mcp2221 import mcp2221
9 """Custom I2C Class for MCP2221"""
11 def __init__(self, *, frequency=100000):
12 self._mcp2221 = mcp2221
13 # self._mcp2221._i2c_configure(frequency)
16 """Perform an I2C Device Scan"""
17 # TODO: We need to fake an I2C scan here
18 return self._mcp2221.i2c_scan()
20 # pylint: disable=unused-argument
21 def writeto(self, address, buffer, *, start=0, end=None, stop=True):
22 """Write data from the buffer to an address"""
23 #self._mcp2221.i2c_writeto(address, buffer, start=start, end=end)
25 def readfrom_into(self, address, buffer, *, start=0, end=None, stop=True):
26 """Read data from an address and into the buffer"""
27 #self._mcp2221.i2c_readfrom_into(address, buffer, start=start, end=end)
29 def writeto_then_readfrom(
41 """Write data from buffer_out to an address and then
42 read data from an address and into buffer_in
46 self._mcp2221.i2c_writeto_then_readfrom(
57 # pylint: enable=unused-argument