1 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
 
   3 # SPDX-License-Identifier: MIT
 
   4 """Chip Definition for MCP2221"""
 
  14     """MCP2221 Device Class Definition"""
 
  17         pass # This is a "fake" implementation
 
  20         """Close the hid device. Does nothing if the device is not open."""
 
  24         # try to close the device before destroying the instance
 
  28     def _hid_xfer(self, report, response=True):
 
  29         """Perform HID Transfer"""
 
  32     # ----------------------------------------------------------------
 
  34     # ----------------------------------------------------------------
 
  35     def gp_get_mode(self, pin):
 
  36         """Get Current Pin Mode"""
 
  39     def gp_set_mode(self, pin, mode):
 
  40         """Set Current Pin Mode"""
 
  43     def _pretty_report(self, register):
 
  46     def _status_dump(self):
 
  55     # ----------------------------------------------------------------
 
  57     # ----------------------------------------------------------------
 
  58     def gpio_set_direction(self, pin, mode):
 
  59         """Set Current GPIO Pin Direction"""
 
  62     def gpio_set_pin(self, pin, value):
 
  63         """Set Current GPIO Pin Value"""
 
  66     def gpio_get_pin(self, pin):
 
  67         """Get Current GPIO Pin Value"""
 
  71     # ----------------------------------------------------------------
 
  73     # ----------------------------------------------------------------
 
  74     def _i2c_status(self):
 
  80     def _i2c_cancel(self):
 
  83     # pylint: disable=too-many-arguments,too-many-branches
 
  84     def _i2c_write(self, cmd, address, buffer, start=0, end=None):
 
  87     def _i2c_read(self, cmd, address, buffer, start=0, end=None):
 
  90     # pylint: enable=too-many-arguments
 
  91     def _i2c_configure(self, baudrate=100000):
 
  95     def i2c_writeto(self, address, buffer, *, start=0, end=None):
 
  96         """Write data from the buffer to an address"""
 
  99     def i2c_readfrom_into(self, address, buffer, *, start=0, end=None):
 
 100         """Read data from an address and into the buffer"""
 
 103     def i2c_writeto_then_readfrom(
 
 114         """Write data from buffer_out to an address and then
 
 115         read data from an address and into buffer_in
 
 119     def i2c_scan(self, *, start=0, end=0x79):
 
 120         """Perform an I2C Device Scan"""
 
 124     # ----------------------------------------------------------------
 
 126     # ----------------------------------------------------------------
 
 127     def adc_configure(self, vref=0):
 
 128         """Configure the Analog-to-Digital Converter"""
 
 131     def adc_read(self, pin):
 
 132         """Read from the Analog-to-Digital Converter"""
 
 135     # ----------------------------------------------------------------
 
 137     # ----------------------------------------------------------------
 
 138     def dac_configure(self, vref=0):
 
 139         """Configure the Digital-to-Analog Converter"""
 
 142     # pylint: disable=unused-argument
 
 143     def dac_write(self, pin, value):
 
 144         """Write to the Digital-to-Analog Converter"""
 
 147     # pylint: enable=unused-argument