Skip to content

Support boards that don't have a fixed I2C bus. #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 29, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion adafruit_seesaw/tftshield18.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ class TFTShield18(Seesaw):
# TypeError: unsupported operand type(s) for <<: 'int' and '_MockObject'
_button_mask = 0xFF

def __init__(self, i2c_bus=board.I2C(), addr=0x2E):
def __init__(self, i2c_bus=None, addr=0x2E):
if i2c_bus == None:
if hasattr(board, "I2C"):
i2c_bus = board.I2C
else:
print("Warning: board has no default I2C bus.")
super().__init__(i2c_bus, addr)
self.pin_mode(_TFTSHIELD_RESET_PIN, self.OUTPUT)
self.pin_mode_bulk(self._button_mask, self.INPUT_PULLUP)
Expand Down