Skip to content

Commit

Permalink
Merge pull request #364 from DarkMechanikum/main
Browse files Browse the repository at this point in the history
Added detection of Starfive JH7110 chip and Starfive VisionFive2 board
  • Loading branch information
makermelissa authored Jul 10, 2024
2 parents ba91425 + 55436d5 commit 9c9fd12
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
9 changes: 8 additions & 1 deletion adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

from adafruit_platformdetect.constants import boards, chips


__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git"

Expand Down Expand Up @@ -63,6 +62,8 @@ def id(self) -> Optional[str]:

if chip_id == chips.H3:
board_id = self._armbian_id() or self._allwinner_variants_id()
elif chip_id == chips.JH7110:
board_id = self._starfive_id()
elif chip_id == chips.BCM2XXX:
board_id = self._pi_id()
elif chip_id == chips.OS_AGNOSTIC:
Expand Down Expand Up @@ -226,6 +227,12 @@ def id(self) -> Optional[str]:
return board_id

# pylint: enable=invalid-name
def _starfive_id(self) -> Optional[str]:
model = None
model_value = self.detector.get_device_model()
if "VisionFive" in model_value and "V2" in model_value:
model = boards.VISIONFIVE2
return model

def _pi_id(self) -> Optional[str]:
"""Try to detect id of a Raspberry Pi."""
Expand Down
5 changes: 3 additions & 2 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"""


import os
import sys

Expand All @@ -30,7 +29,6 @@

from adafruit_platformdetect.constants import chips


__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git"

Expand Down Expand Up @@ -224,6 +222,9 @@ def _linux_id(self) -> Optional[str]:
if self.detector.check_dt_compatible_value("jh7100"):
return chips.JH71X0

if self.detector.check_dt_compatible_value("jh7110"):
return chips.JH7110

if self.detector.check_dt_compatible_value("sun8i-a33"):
return chips.A33

Expand Down
4 changes: 3 additions & 1 deletion adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

"""Definition of boards and/or ids"""
# Allow for aligned constant definitions:
VISIONFIVE2 = "VISIONFIVE2"
BEAGLE_PLAY = "BEAGLE_PLAY"
BEAGLEBONE_AI64 = "BEAGLEBONE_AI64"
BEAGLEBONE = "BEAGLEBONE"
Expand Down Expand Up @@ -73,7 +74,6 @@
NANOPI_NEO = "NANOPI_NEO"
NANOPI_NEO_2 = "NANOPI_NEO_2"


# Banana Pi boards
BANANA_PI_M2_ZERO = "BANANA_PI_M2_ZERO"
BANANA_PI_M2_PLUS = "BANANA_PI_M2_PLUS"
Expand Down Expand Up @@ -243,6 +243,8 @@
LUCKFOX_PICO_MINI = "LUCKFOX_PICO_MINI"
LUCKFOX_PICO_PLUS = "LUCKFOX_PICO_PLUS"

# StarFive boards
_STARFIVE_BOARD_IDS = (VISIONFIVE2,)
# Asus Tinkerboard
_ASUS_TINKER_BOARD_IDS = (
ASUS_TINKER_BOARD,
Expand Down
1 change: 1 addition & 0 deletions adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
HFU540 = "HFU540"
C906 = "C906"
JH71X0 = "JH71X0"
JH7110 = "JH7110"
MCP2221 = "MCP2221"
BINHO = "BINHO"
MIPS24KC = "MIPS24KC"
Expand Down

0 comments on commit 9c9fd12

Please sign in to comment.