Skip to content

Commit 858f7d5

Browse files
authored
Merge pull request #251 from Ryzer58/main
Add support for Linksprite Pcduino models 2 & 3.
2 parents 718ecbe + 10a16d9 commit 858f7d5

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
.idea
77
__pycache__
88
_build
9+
build
910
*.pyc
1011
.env
1112
bundles

adafruit_platformdetect/board.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ def id(self) -> Optional[str]:
7171
board_id = self._siemens_simatic_iot2000_id()
7272
elif chip_id == chips.DRA74X:
7373
board_id = self._bbai_id()
74+
elif chip_id == chips.SUN4I:
75+
board_id = self._armbian_id()
76+
elif chip_id == chips.SUN7I:
77+
board_id = self._armbian_id()
7478
elif chip_id == chips.SUN8I:
7579
board_id = self._armbian_id() or self._allwinner_variants_id()
7680
elif chip_id == chips.SAMA5:
@@ -127,6 +131,10 @@ def id(self) -> Optional[str]:
127131
board_id = boards.ONION_OMEGA2
128132
elif chip_id == chips.ZYNQ7000:
129133
board_id = self._pynq_id()
134+
elif chip_id == chips.A10:
135+
board_id = self._armbian_id()
136+
elif chip_id == chips.A20:
137+
board_id = self._armbian_id()
130138
elif chip_id == chips.A64:
131139
board_id = self._pine64_id()
132140
elif chip_id == chips.H6:
@@ -338,6 +346,10 @@ def _armbian_id(self) -> Optional[str]:
338346
board = boards.NANOPI_NEO
339347
elif board_value == "nezha":
340348
board = boards.LICHEE_RV
349+
elif board_value == "pcduino2":
350+
board = boards.PCDUINO2
351+
elif board_value == "pcduino3":
352+
board = boards.PCDUINO3
341353

342354
return board
343355

@@ -493,6 +505,16 @@ def _asus_tinker_board_id(self) -> Optional[str]:
493505
board = boards._ASUS_TINKER_BOARD_IDS
494506
return board
495507

508+
def _pcduino_board_id(self) -> Optional[str]:
509+
"""Check on the type of Pcduino"""
510+
board_value = self.detector.get_device_model()
511+
board = None
512+
if "pcduino2" in board_value.lower():
513+
board = boards.PCDUINO2
514+
if "pcduino3" in board_value.lower():
515+
board = boards.PCDUINO3
516+
return board
517+
496518
def _allwinner_variants_id(self) -> Optional[str]:
497519
"""Try to detect the id of allwinner based board. (orangepi, nanopi)"""
498520
board_value = self.detector.get_device_model()
@@ -663,6 +685,11 @@ def any_asus_tinker_board(self) -> bool:
663685
"""Check to see if the current board is an ASUS Tinker Board"""
664686
return self.id in boards._ASUS_TINKER_BOARD_IDS
665687

688+
@property
689+
def any_pcduino_board(self) -> bool:
690+
"""Check whether the current board is any Pcduino board"""
691+
return self.id in boards._PCDUINO_DEV_IDS
692+
666693
@property
667694
def any_stm32mp1(self) -> bool:
668695
"""Check whether the current board is any stm32mp1 board."""
@@ -719,6 +746,7 @@ def any_embedded_linux(self) -> bool:
719746
self.any_tisk_board,
720747
self.any_siemens_simatic_iot2000,
721748
self.any_lichee_riscv_board,
749+
self.any_pcduino_board,
722750
]
723751
)
724752

adafruit_platformdetect/chip.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ def _linux_id(self) -> Optional[str]:
172172
if self.detector.check_dt_compatible_value("ti,am652"):
173173
return chips.AM65XX
174174

175+
if self.detector.check_dt_compatible_value("sun4i-a10"):
176+
return chips.A10
177+
178+
if self.detector.check_dt_compatible_value("sun7i-a20"):
179+
return chips.A20
180+
175181
if self.detector.check_dt_compatible_value("amlogic,g12a"):
176182
return chips.S905Y2
177183
if self.detector.check_dt_compatible_value("amlogic, g12a"):
@@ -330,6 +336,10 @@ def _linux_id(self) -> Optional[str]:
330336
linux_id = chips.AM33XX
331337
elif "DRA74X" in hardware:
332338
linux_id = chips.DRA74X
339+
elif "sun4i" in hardware:
340+
linux_id = chips.A10
341+
elif "sun7i" in hardware:
342+
linux_id = chips.A20
333343
elif "sun8i" in hardware:
334344
linux_id = chips.SUN8I
335345
elif "ODROIDC" in hardware:

adafruit_platformdetect/constants/boards.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@
133133

134134
MICROCHIP_MCP2221 = "MICROCHIP_MCP2221"
135135

136+
# Linkspirte Pcduino based boards
137+
PCDUINO2 = "PCDUINO2"
138+
PCDUINO3 = "PCDUINO3"
139+
136140
# Boards with u2if firmware
137141
# https://github.com/execuc/u2if
138142
PICO_U2IF = "PICO_U2IF"
@@ -513,6 +517,8 @@
513517
# Pine64 boards and devices
514518
_PINE64_DEV_IDS = (PINE64, PINEH64, PINEBOOK, PINEPHONE, SOPINE)
515519

520+
# Pcduino baords
521+
_PCDUINO_DEV_IDS = (PCDUINO2, PCDUINO3)
516522
# RockPi boards and devices
517523
_ROCK_PI_IDS = (ROCK_PI_S, ROCK_PI_4, ROCK_PI_X, ROCK_PI_E, RADXA_ZERO)
518524

adafruit_platformdetect/constants/chips.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
RYZEN_V1202B = "RYZEN_V1202B"
1717
RYZEN_V1605B = "RYZEN_V1605B"
1818
SAMD21 = "SAMD21"
19+
SUN4I = "SUN4I"
20+
SUN7I = "SUN7I"
1921
SUN8I = "SUN8I"
2022
S805 = "S805"
2123
S905 = "S905"
@@ -39,6 +41,8 @@
3941
MIPS24KC = "MIPS24KC"
4042
MIPS24KEC = "MIPS24KEC"
4143
ZYNQ7000 = "ZYNQ7000"
44+
A10 = "A10"
45+
A20 = "A20"
4246
A64 = "A64"
4347
H6 = "H6"
4448
A33 = "A33"

0 commit comments

Comments
 (0)