Skip to content

Commit 6ed1e21

Browse files
committed
blacken
1 parent b47de02 commit 6ed1e21

File tree

1 file changed

+11
-5
lines changed
  • src/adafruit_blinka/microcontroller/fake_mcp2221

1 file changed

+11
-5
lines changed

src/adafruit_blinka/microcontroller/fake_mcp2221/pin.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,24 @@ def init(self, mode=IN, pull=None):
2727
if self.id is None:
2828
raise RuntimeError("Can not init a None type pin.")
2929
if pull is not None:
30-
raise NotImplementedError(
31-
"Internal pullups and pulldowns not supported on the MCP2221"
32-
)
33-
if mode == Pin.ADC:
30+
raise NotImplementedError("Internal pullups and pulldowns not supported")
31+
if mode in (Pin.IN, Pin.OUT):
32+
# All pins can do GPIO
33+
# mcp2221.gp_set_mode(self.id, mcp2221.GP_GPIO)
34+
# mcp2221.gpio_set_direction(self.id, mode)
35+
self._mode = mode
36+
elif mode == Pin.ADC:
3437
# ADC only available on these pins
3538
if self.id not in (1, 2, 3):
3639
raise ValueError("Pin does not have ADC capabilities")
37-
# Do nothing
40+
# mcp2221.gp_set_mode(self.id, mcp2221.GP_ALT0)
41+
# mcp2221.adc_configure()
3842
elif mode == Pin.DAC:
3943
# DAC only available on these pins
4044
if self.id not in (2, 3):
4145
raise ValueError("Pin does not have DAC capabilities")
46+
# mcp2221.gp_set_mode(self.id, mcp2221.GP_ALT1)
47+
# mcp2221.dac_configure()
4248
else:
4349
raise ValueError("Incorrect pin mode: {}".format(mode))
4450
self._mode = mode

0 commit comments

Comments
 (0)