Skip to content

Commit 46f0930

Browse files
authored
Merge pull request #385 from bablokb/radxa_x4
add support for Radxa-X4 via U2IF
2 parents 7e3169b + 691e0fe commit 46f0930

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

adafruit_platformdetect/board.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,8 @@ def _rp2040_u2if_id(self) -> Optional[str]:
896896
product = dev["product_id"]
897897
if vendor == 0xCAFE and product == 0x4005:
898898
return boards.PICO_U2IF
899+
if vendor == 0xCAFF and product == 0x4005:
900+
return boards.RADXA_X4_U2IF
899901
if vendor == 0x239A:
900902
# Feather RP2040
901903
if product == 0x00F1:
@@ -1203,6 +1205,7 @@ def lazily_generate_conditions():
12031205
yield self.board.QT2040_TRINKEY_U2IF
12041206
yield self.board.KB2040_U2IF
12051207
yield self.board.RP2040_ONE_U2IF
1208+
yield self.board.RADXA_X4_U2IF
12061209
yield self.board.OS_AGNOSTIC_BOARD
12071210

12081211
return any(condition for condition in lazily_generate_conditions())
@@ -1342,6 +1345,11 @@ def rp2040_one_u2if(self) -> bool:
13421345
"""Check whether the current board is an RP2040 One w/ u2if."""
13431346
return self.id == boards.RP2040_ONE_U2IF
13441347

1348+
@property
1349+
def radxa_x4_u2if(self) -> bool:
1350+
"""Check whether the current board is an RP2040 One w/ u2if."""
1351+
return self.id == boards.RADXA_X4_U2IF
1352+
13451353
@property
13461354
def binho_nova(self) -> bool:
13471355
"""Check whether the current board is an BINHO NOVA."""

adafruit_platformdetect/chip.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ def id(
125125
if (
126126
(
127127
# Raspberry Pi Pico
128-
vendor == 0xCAFE
128+
# Radxa X4
129+
vendor in (0xCAFE, 0xCAFF)
129130
and product == 0x4005
130131
)
131132
or (

adafruit_platformdetect/constants/boards.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
KB2040_U2IF = "KB2040_U2IF"
196196

197197
RP2040_ONE_U2IF = "RP2040_ONE_U2IF"
198+
RADXA_X4_U2IF = "RADXA_X4_U2IF"
198199

199200
BINHO_NOVA = "BINHO_NOVA"
200201

0 commit comments

Comments
 (0)