]> Repositories - hackapet/Adafruit_Blinka.git/blobdiff - src/adafruit_blinka/microcontroller/fake_mcp2221/pin.py
blacken
[hackapet/Adafruit_Blinka.git] / src / adafruit_blinka / microcontroller / fake_mcp2221 / pin.py
index 27a1c562e6bfa77daeb991e1fb16cfdc028df147..f522a39e8ac9e223094e62902e2a2212ad7926bd 100644 (file)
@@ -3,7 +3,6 @@
 # SPDX-License-Identifier: MIT
 """fake_mcp2221 pin names"""
 import random
-from .fake_mcp2221 import mcp2221
 
 
 class Pin:
@@ -28,21 +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")
+            raise NotImplementedError("Internal pullups and pulldowns not supported")
         if mode in (Pin.IN, Pin.OUT):
             # All pins can do GPIO
-            pass
+            # 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")
-            pass
-            # 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")
-            pass
+            # mcp2221.gp_set_mode(self.id, mcp2221.GP_ALT1)
+            # mcp2221.dac_configure()
         else:
             raise ValueError("Incorrect pin mode: {}".format(mode))
         self._mode = mode
@@ -90,4 +92,4 @@ G2 = Pin(2)
 G3 = Pin(3)
 
 SCL = Pin()
-SDA = Pin()
\ No newline at end of file
+SDA = Pin()