From: brentru Date: Wed, 3 Apr 2024 15:26:11 +0000 (-0400) Subject: blacken X-Git-Tag: 8.39.0^2~2 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/6ed1e2116d59fa76a9819191b3bd84b9bd3d02e7?hp=-c blacken --- 6ed1e2116d59fa76a9819191b3bd84b9bd3d02e7 diff --git a/src/adafruit_blinka/microcontroller/fake_mcp2221/pin.py b/src/adafruit_blinka/microcontroller/fake_mcp2221/pin.py index f3b6b1f..f522a39 100644 --- a/src/adafruit_blinka/microcontroller/fake_mcp2221/pin.py +++ b/src/adafruit_blinka/microcontroller/fake_mcp2221/pin.py @@ -27,18 +27,24 @@ class Pin: if self.id is None: raise RuntimeError("Can not init a None type pin.") if pull is not None: - raise NotImplementedError( - "Internal pullups and pulldowns not supported on the MCP2221" - ) - if mode == Pin.ADC: + raise NotImplementedError("Internal pullups and pulldowns not supported") + if mode in (Pin.IN, Pin.OUT): + # All pins can do GPIO + # mcp2221.gp_set_mode(self.id, mcp2221.GP_GPIO) + # mcp2221.gpio_set_direction(self.id, mode) + self._mode = mode + elif mode == Pin.ADC: # ADC only available on these pins if self.id not in (1, 2, 3): raise ValueError("Pin does not have ADC capabilities") - # Do nothing + # mcp2221.gp_set_mode(self.id, mcp2221.GP_ALT0) + # mcp2221.adc_configure() elif mode == Pin.DAC: # DAC only available on these pins if self.id not in (2, 3): raise ValueError("Pin does not have DAC capabilities") + # mcp2221.gp_set_mode(self.id, mcp2221.GP_ALT1) + # mcp2221.dac_configure() else: raise ValueError("Incorrect pin mode: {}".format(mode)) self._mode = mode