Skip to content

Include Waveshare RP2040 One (3 of 3) #366

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 10 commits into from
Aug 8, 2024
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
8 changes: 8 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ def _rp2040_u2if_id(self) -> Optional[str]:
# KB2040 Kee Board
if product == 0x0105:
return boards.KB2040_U2IF
if vendor == 0x2E8A and product == 0x103A:
return boards.RP2040_ONE_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 @@ -1082,6 +1084,7 @@ def lazily_generate_conditions():
yield self.board.QTPY_U2IF
yield self.board.QT2040_TRINKEY_U2IF
yield self.board.KB2040_U2IF
yield self.board.RP2040_ONE_U2IF
yield self.board.OS_AGNOSTIC_BOARD

return any(condition for condition in lazily_generate_conditions())
Expand Down Expand Up @@ -1209,6 +1212,11 @@ def kb2040_u2if(self) -> bool:
"""Check whether the current board is a KB2040 w/ u2if."""
return self.id == boards.KB2040_U2IF

@property
def rp2040_one_u2if(self) -> bool:
"""Check whether the current board is an RP2040 One w/ u2if."""
return self.id == boards.RP2040_ONE_U2IF

@property
def binho_nova(self) -> bool:
"""Check whether the current board is an BINHO NOVA."""
Expand Down
57 changes: 33 additions & 24 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,31 +109,40 @@ def id(
product = dev["product_id"]
# NOTE: If any products are added here, they need added
# to _rp2040_u2if_id() in board.py as well.
# pylint: disable=too-many-boolean-expressions
if (
# Raspberry Pi Pico
vendor == 0xCAFE
and product == 0x4005
) or (
# Feather RP2040
# Itsy Bitsy RP2040
# QT Py RP2040
# 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,
0x812E,
0x8130,
0x0105,
(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we remove the extra set of parenthesis?

# Raspberry Pi Pico
vendor == 0xCAFE
and product == 0x4005
)
or (
# Waveshare RP2040 One
vendor == 0x2E8A
and product == 0x103A
)
or (
# Feather RP2040
# Itsy Bitsy RP2040
# QT Py RP2040
# 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,
0x812E,
0x8130,
0x0105,
)
)
):
self._chip_id = chips.RP2040_U2IF
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 @@ -183,6 +183,8 @@
QT2040_TRINKEY_U2IF = "QT2040_TRINKEY_U2IF"
KB2040_U2IF = "KB2040_U2IF"

RP2040_ONE_U2IF = "RP2040_ONE_U2IF"

BINHO_NOVA = "BINHO_NOVA"

ONION_OMEGA = "ONION_OMEGA"
Expand Down
Loading