Skip to content

Commit e5dc15f

Browse files
committed
Adding Feather RP2040 EPD
Adding Feather RP2040 EPD to use with U2IF
1 parent cf93300 commit e5dc15f

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

adafruit_platformdetect/board.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def _pi_rev_code(self) -> Optional[str]:
250250
except FileNotFoundError:
251251
return None
252252

253-
# pylint: disable=no-self-use
253+
# pylint: disable=useless-option-value
254254
def _beaglebone_id(self) -> Optional[str]:
255255
"""Try to detect id of a Beaglebone."""
256256
board_value = self.detector.get_device_compatible()
@@ -289,7 +289,7 @@ def _beaglebone_id(self) -> Optional[str]:
289289
board_value = self.detector.get_armbian_release_field("BOARD")
290290
return None
291291

292-
# pylint: enable=no-self-use
292+
# pylint: enable=useless-option-value
293293

294294
def _bbai_id(self) -> Optional[str]:
295295
"""Try to detect id of a Beaglebone AI related board."""
@@ -477,7 +477,7 @@ def _pine64_id(self) -> Optional[str]:
477477
board = boards.SOPINE
478478
return board
479479

480-
# pylint: disable=no-self-use
480+
# pylint: disable=useless-option-value
481481
def _pynq_id(self) -> Optional[str]:
482482
"""Try to detect the id for Xilinx PYNQ boards."""
483483
try:
@@ -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)