Skip to content

Commit 6965f72

Browse files
authored
Merge pull request #286 from BlitzCityDIY/main
Adding Feather RP2040 EPD
2 parents cf93300 + 4fe85aa commit 6965f72

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

adafruit_platformdetect/board.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,8 @@ def _allwinner_variants_id(self) -> Optional[str]:
617617
# TODO: Add other specifc board contexts here
618618
return board
619619

620+
# pylint: disable=too-many-return-statements
621+
620622
def _rp2040_u2if_id(self) -> Optional[str]:
621623
import hid
622624

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

654+
# pylint: enable=too-many-return-statements
655+
649656
def _siemens_simatic_iot2000_id(self) -> Optional[str]:
650657
"""Try to detect if this is a IOT2050 Gateway."""
651658
board_value = self.detector.get_device_model()
@@ -823,6 +830,7 @@ def lazily_generate_conditions():
823830
yield self.board.GREATFET_ONE
824831
yield self.board.PICO_U2IF
825832
yield self.board.FEATHER_U2IF
833+
yield self.board.FEATHER_EPD_U2IF
826834
yield self.board.ITSYBITY_U2IF
827835
yield self.board.MACROPAD_U2IF
828836
yield self.board.QTPY_U2IF
@@ -899,6 +907,11 @@ def feather_u2if(self) -> bool:
899907
"""Check whether the current board is a Feather RP2040 w/ u2if."""
900908
return self.id == boards.FEATHER_U2IF
901909

910+
@property
911+
def feather_epd_u2if(self) -> bool:
912+
"""Check whether the current board is a Feather ThinkInk RP2040 w/ u2if."""
913+
return self.id == boards.FEATHER_EPD_U2IF
914+
902915
@property
903916
def itsybitsy_u2if(self) -> bool:
904917
"""Check whether the current board is a Itsy Bitsy w/ u2if."""

adafruit_platformdetect/chip.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ def __init__(self, detector) -> None:
4242
self.detector = detector
4343
self._chip_id = None
4444

45+
# pylint: disable=invalid-name,too-many-branches,too-many-return-statements
4546
@property
4647
def id(
4748
self,
48-
) -> Optional[
49-
str
50-
]: # pylint: disable=invalid-name,too-many-branches,too-many-return-statements
49+
) -> Optional[str]:
5150
"""Return a unique id for the detected chip, if any."""
5251
# There are some times we want to trick the platform detection
5352
# say if a raspberry pi doesn't have the right ID, or for testing
@@ -118,8 +117,9 @@ def id(
118117
# QT Py RP2040
119118
# QT2040 Trinkey
120119
# MacroPad RP2040
120+
# Feather RP2040 ThinkInk
121121
vendor == 0x239A
122-
and product in (0x00F1, 0x00FD, 0x00F7, 0x0109, 0x0107)
122+
and product in (0x00F1, 0x00FD, 0x00F7, 0x0109, 0x0107, 0x812C)
123123
):
124124
self._chip_id = chips.RP2040_U2IF
125125
return self._chip_id

adafruit_platformdetect/constants/boards.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
# https://github.com/execuc/u2if
148148
PICO_U2IF = "PICO_U2IF"
149149
FEATHER_U2IF = "FEATHER_U2IF"
150+
FEATHER_EPD_U2IF = "FEATHER_EPD_U2IF"
150151
ITSYBITSY_U2IF = "ITSYBITSY_U2IF"
151152
MACROPAD_U2IF = "MACROPAD_U2IF"
152153
QTPY_U2IF = "QTPY_U2IF"

0 commit comments

Comments
 (0)