Skip to content

pass additonal pins as arguments #66

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 2 commits into from
Dec 19, 2020
Merged
Changes from all commits
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
24 changes: 19 additions & 5 deletions adafruit_featherwing/keyboard_featherwing.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,23 @@


# pylint: disable-msg=too-few-public-methods
# pylint: disable-msg=too-many-arguments
class KeyboardFeatherwing:
"""Class representing a `Keyboard Featherwing`
<https://www.tindie.com/products/arturo182/keyboard-featherwing-qwerty-keyboard-26-lcd/>`_.

"""

def __init__(self, spi=None, cs=None, dc=None, i2c=None):
def __init__(
self,
spi=None,
cs=None,
dc=None,
i2c=None,
ts_cs=None,
sd_cs=None,
neopixel_pin=None,
):
displayio.release_displays()
if spi is None:
spi = board.SPI()
Expand All @@ -64,15 +74,19 @@ def __init__(self, spi=None, cs=None, dc=None, i2c=None):
dc = board.D10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was the default for dc here removed intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No -- I will restore it -- surprised it worked OK on the stm32...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored - thanks for catching that.

if i2c is None:
i2c = board.I2C()
if ts_cs is None:
ts_cs = board.D6
if sd_cs is None:
sd_cs = board.D5
if neopixel_pin is None:
neopixel_pin = board.D11

ts_cs = digitalio.DigitalInOut(board.D6)
self.touchscreen = Adafruit_STMPE610_SPI(spi, ts_cs)
self.touchscreen = Adafruit_STMPE610_SPI(spi, digitalio.DigitalInOut(ts_cs))

display_bus = displayio.FourWire(spi, command=dc, chip_select=cs)
self.display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)
self.neopixel = neopixel.NeoPixel(board.D11, 1)
self.neopixel = neopixel.NeoPixel(neopixel_pin, 1)
self.keyboard = BBQ10Keyboard(i2c)
sd_cs = board.D5
self._sdcard = None
try:
self._sdcard = sdcardio.SDCard(spi, sd_cs)
Expand Down