Skip to content

Adding support for CAN and RFM Feather #289

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
Apr 11, 2023
Merged
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,12 @@ def _rp2040_u2if_id(self) -> Optional[str]:
# Feather RP2040 ThinkInk
if product == 0x812C:
return boards.FEATHER_EPD_U2IF
# Feather RP2040 RFM
if product == 0x812E:
return boards.FEATHER_RFM_U2IF
# Feather RP2040 CAN
if product == 0x8130:
return boards.FEATHER_CAN_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.")

Expand Down Expand Up @@ -830,7 +836,9 @@ def lazily_generate_conditions():
yield self.board.GREATFET_ONE
yield self.board.PICO_U2IF
yield self.board.FEATHER_U2IF
yield self.board.FEATHER_CAN_U2IF
yield self.board.FEATHER_EPD_U2IF
yield self.board.FEATHER_RFM_U2IF
yield self.board.ITSYBITY_U2IF
yield self.board.MACROPAD_U2IF
yield self.board.QTPY_U2IF
Expand Down Expand Up @@ -907,11 +915,21 @@ 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_can_u2if(self) -> bool:
"""Check whether the current board is a Feather CAN Bus RP2040 w/ u2if."""
return self.id == boards.FEATHER_CAN_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 feather_rfm_u2if(self) -> bool:
"""Check whether the current board is a Feather RFM RP2040 w/ u2if."""
return self.id == boards.FEATHER_RFM_U2IF

@property
def itsybitsy_u2if(self) -> bool:
"""Check whether the current board is a Itsy Bitsy w/ u2if."""
Expand Down
14 changes: 13 additions & 1 deletion adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,20 @@ def id(
# QT2040 Trinkey
# MacroPad RP2040
# Feather RP2040 ThinkInk
# Feather RP2040 RFM
# Feather RP2040 CAN Bus
vendor == 0x239A
and product in (0x00F1, 0x00FD, 0x00F7, 0x0109, 0x0107, 0x812C)
and product
in (
0x00F1,
0x00FD,
0x00F7,
0x0109,
0x0107,
0x812C,
0x812E,
0x8130,
)
):
self._chip_id = chips.RP2040_U2IF
return self._chip_id
Expand Down
2 changes: 2 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@
# https://github.com/execuc/u2if
PICO_U2IF = "PICO_U2IF"
FEATHER_U2IF = "FEATHER_U2IF"
FEATHER_CAN_U2IF = "FEATHER_CAN_U2IF"
FEATHER_EPD_U2IF = "FEATHER_EPD_U2IF"
FEATHER_RFM_U2IF = "FEATHER_RFM_U2IF"
ITSYBITSY_U2IF = "ITSYBITSY_U2IF"
MACROPAD_U2IF = "MACROPAD_U2IF"
QTPY_U2IF = "QTPY_U2IF"
Expand Down