Skip to content

Commit 20f52a2

Browse files
authored
Merge pull request #366 from johnnohj/main
Include Waveshare RP2040 One (3 of 3)
2 parents fa12191 + 1a52b53 commit 20f52a2

File tree

3 files changed

+43
-24
lines changed

3 files changed

+43
-24
lines changed

adafruit_platformdetect/board.py

+8
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,8 @@ def _rp2040_u2if_id(self) -> Optional[str]:
832832
# KB2040 Kee Board
833833
if product == 0x0105:
834834
return boards.KB2040_U2IF
835+
if vendor == 0x2E8A and product == 0x103A:
836+
return boards.RP2040_ONE_U2IF
835837
# Will only reach here if a device was added in chip.py but here.
836838
raise RuntimeError("RP2040_U2IF device was added to chip but not board.")
837839

@@ -1082,6 +1084,7 @@ def lazily_generate_conditions():
10821084
yield self.board.QTPY_U2IF
10831085
yield self.board.QT2040_TRINKEY_U2IF
10841086
yield self.board.KB2040_U2IF
1087+
yield self.board.RP2040_ONE_U2IF
10851088
yield self.board.OS_AGNOSTIC_BOARD
10861089

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

1215+
@property
1216+
def rp2040_one_u2if(self) -> bool:
1217+
"""Check whether the current board is an RP2040 One w/ u2if."""
1218+
return self.id == boards.RP2040_ONE_U2IF
1219+
12121220
@property
12131221
def binho_nova(self) -> bool:
12141222
"""Check whether the current board is an BINHO NOVA."""

adafruit_platformdetect/chip.py

+33-24
Original file line numberDiff line numberDiff line change
@@ -109,31 +109,40 @@ def id(
109109
product = dev["product_id"]
110110
# NOTE: If any products are added here, they need added
111111
# to _rp2040_u2if_id() in board.py as well.
112+
# pylint: disable=too-many-boolean-expressions
112113
if (
113-
# Raspberry Pi Pico
114-
vendor == 0xCAFE
115-
and product == 0x4005
116-
) or (
117-
# Feather RP2040
118-
# Itsy Bitsy RP2040
119-
# QT Py RP2040
120-
# QT2040 Trinkey
121-
# MacroPad RP2040
122-
# Feather RP2040 ThinkInk
123-
# Feather RP2040 RFM
124-
# Feather RP2040 CAN Bus
125-
vendor == 0x239A
126-
and product
127-
in (
128-
0x00F1,
129-
0x00FD,
130-
0x00F7,
131-
0x0109,
132-
0x0107,
133-
0x812C,
134-
0x812E,
135-
0x8130,
136-
0x0105,
114+
(
115+
# Raspberry Pi Pico
116+
vendor == 0xCAFE
117+
and product == 0x4005
118+
)
119+
or (
120+
# Waveshare RP2040 One
121+
vendor == 0x2E8A
122+
and product == 0x103A
123+
)
124+
or (
125+
# Feather RP2040
126+
# Itsy Bitsy RP2040
127+
# QT Py RP2040
128+
# QT2040 Trinkey
129+
# MacroPad RP2040
130+
# Feather RP2040 ThinkInk
131+
# Feather RP2040 RFM
132+
# Feather RP2040 CAN Bus
133+
vendor == 0x239A
134+
and product
135+
in (
136+
0x00F1,
137+
0x00FD,
138+
0x00F7,
139+
0x0109,
140+
0x0107,
141+
0x812C,
142+
0x812E,
143+
0x8130,
144+
0x0105,
145+
)
137146
)
138147
):
139148
self._chip_id = chips.RP2040_U2IF

adafruit_platformdetect/constants/boards.py

+2
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@
183183
QT2040_TRINKEY_U2IF = "QT2040_TRINKEY_U2IF"
184184
KB2040_U2IF = "KB2040_U2IF"
185185

186+
RP2040_ONE_U2IF = "RP2040_ONE_U2IF"
187+
186188
BINHO_NOVA = "BINHO_NOVA"
187189

188190
ONION_OMEGA = "ONION_OMEGA"

0 commit comments

Comments
 (0)