Skip to content

Commit f556443

Browse files
Add power control to I2C bus (Adafruit FeatherS2)
1 parent 071f776 commit f556443

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

cpython/kbdFeatherWing/lib/pydos_ui.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class PyDOS_UI:
3333
SHIFT = 1
3434
ALT = 2
3535
#_kbd = None
36+
_I2C_power = None
3637

3738
def __init__(self):
3839
# Release any resources currently in use for the displays
@@ -53,6 +54,11 @@ def __init__(self):
5354
self.lastCmdLine = ""
5455

5556
def I2C():
57+
if 'I2C_POWER_INVERTED' in dir(board) and not PyDOS_UI._I2C_power:
58+
PyDOS_UI._I2C_power = digitalio.DigitalInOut(board.I2C_POWER_INVERTED)
59+
PyDOS_UI._I2C_power.direction = digitalio.Direction.OUTPUT
60+
PyDOS_UI._I2C_power.value = False
61+
5662
return board.I2C()
5763

5864
def serial_bytes_available(self):

cpython/kbdFeatherWing/lib/pydos_ui_kfw.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class PyDOS_UI:
3333
SHIFT = 1
3434
ALT = 2
3535
#_kbd = None
36+
_I2C_power = None
3637

3738
def __init__(self):
3839
# Release any resources currently in use for the displays
@@ -53,6 +54,11 @@ def __init__(self):
5354
self.lastCmdLine = ""
5455

5556
def I2C():
57+
if 'I2C_POWER_INVERTED' in dir(board) and not PyDOS_UI._I2C_power:
58+
PyDOS_UI._I2C_power = digitalio.DigitalInOut(board.I2C_POWER_INVERTED)
59+
PyDOS_UI._I2C_power.direction = digitalio.Direction.OUTPUT
60+
PyDOS_UI._I2C_power.value = False
61+
5662
return board.I2C()
5763

5864
def serial_bytes_available(self):

0 commit comments

Comments
 (0)