Skip to content

Commit

Permalink
Merge pull request #286 from BlitzCityDIY/main
Browse files Browse the repository at this point in the history
Adding Feather RP2040 EPD
  • Loading branch information
makermelissa authored Apr 3, 2023
2 parents cf93300 + 4fe85aa commit 6965f72
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
13 changes: 13 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ def _allwinner_variants_id(self) -> Optional[str]:
# TODO: Add other specifc board contexts here
return board

# pylint: disable=too-many-return-statements

def _rp2040_u2if_id(self) -> Optional[str]:
import hid

Expand All @@ -643,9 +645,14 @@ def _rp2040_u2if_id(self) -> Optional[str]:
# MacroPad RP2040
if product == 0x0107:
return boards.MACROPAD_U2IF
# Feather RP2040 ThinkInk
if product == 0x812C:
return boards.FEATHER_EPD_U2IF
# Will only reach here if a device was added in chip.py but here.
raise RuntimeError("RP2040_U2IF device was added to chip but not board.")

# pylint: enable=too-many-return-statements

def _siemens_simatic_iot2000_id(self) -> Optional[str]:
"""Try to detect if this is a IOT2050 Gateway."""
board_value = self.detector.get_device_model()
Expand Down Expand Up @@ -823,6 +830,7 @@ def lazily_generate_conditions():
yield self.board.GREATFET_ONE
yield self.board.PICO_U2IF
yield self.board.FEATHER_U2IF
yield self.board.FEATHER_EPD_U2IF
yield self.board.ITSYBITY_U2IF
yield self.board.MACROPAD_U2IF
yield self.board.QTPY_U2IF
Expand Down Expand Up @@ -899,6 +907,11 @@ def feather_u2if(self) -> bool:
"""Check whether the current board is a Feather RP2040 w/ u2if."""
return self.id == boards.FEATHER_U2IF

@property
def feather_epd_u2if(self) -> bool:
"""Check whether the current board is a Feather ThinkInk RP2040 w/ u2if."""
return self.id == boards.FEATHER_EPD_U2IF

@property
def itsybitsy_u2if(self) -> bool:
"""Check whether the current board is a Itsy Bitsy w/ u2if."""
Expand Down
8 changes: 4 additions & 4 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ def __init__(self, detector) -> None:
self.detector = detector
self._chip_id = None

# pylint: disable=invalid-name,too-many-branches,too-many-return-statements
@property
def id(
self,
) -> Optional[
str
]: # pylint: disable=invalid-name,too-many-branches,too-many-return-statements
) -> Optional[str]:
"""Return a unique id for the detected chip, if any."""
# There are some times we want to trick the platform detection
# say if a raspberry pi doesn't have the right ID, or for testing
Expand Down Expand Up @@ -118,8 +117,9 @@ def id(
# QT Py RP2040
# QT2040 Trinkey
# MacroPad RP2040
# Feather RP2040 ThinkInk
vendor == 0x239A
and product in (0x00F1, 0x00FD, 0x00F7, 0x0109, 0x0107)
and product in (0x00F1, 0x00FD, 0x00F7, 0x0109, 0x0107, 0x812C)
):
self._chip_id = chips.RP2040_U2IF
return self._chip_id
Expand Down
1 change: 1 addition & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
# https://github.com/execuc/u2if
PICO_U2IF = "PICO_U2IF"
FEATHER_U2IF = "FEATHER_U2IF"
FEATHER_EPD_U2IF = "FEATHER_EPD_U2IF"
ITSYBITSY_U2IF = "ITSYBITSY_U2IF"
MACROPAD_U2IF = "MACROPAD_U2IF"
QTPY_U2IF = "QTPY_U2IF"
Expand Down

0 comments on commit 6965f72

Please sign in to comment.