Skip to content

Commit

Permalink
Merge pull request #310 from sc-bin/main
Browse files Browse the repository at this point in the history
add support for walnutpi-1b
  • Loading branch information
makermelissa committed Sep 5, 2023
2 parents 86f614b + f99e1db commit 95fb4af
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@ def _allwinner_variants_id(self) -> Optional[str]:
board = boards.ORANGE_PI_ZERO_PLUS_2H5
elif "H616" in chip_id:
board = boards.ORANGE_PI_ZERO_2
elif "walnutpi-1b" in board_value:
board = boards.WALNUT_PI_1B
# TODO: Add other specifc board contexts here
return board

Expand Down Expand Up @@ -749,6 +751,11 @@ def any_siemens_simatic_iot2000(self) -> bool:
"""Check whether the current board is a SIEMENS SIMATIC IOT2000 Gateway."""
return self.id in boards._SIEMENS_SIMATIC_IOT2000_IDS

@property
def any_walnutpi(self) -> bool:
"""Check whether the current board is any defined Walnut Pi."""
return self.id in boards._WALNUT_PI_IDS

@property
def any_nanopi(self) -> bool:
"""Check whether the current board is any defined Nano Pi."""
Expand Down Expand Up @@ -970,6 +977,7 @@ def lazily_generate_conditions():
yield self.any_libre_computer_board
yield self.generic_linux
yield self.any_nxp_navq_board
yield self.any_walnutpi

return any(condition for condition in lazily_generate_conditions())

Expand Down
6 changes: 6 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
ASUS_TINKER_BOARD_2 = "ASUS_TINKER_BOARD_2"
ASUS_TINKER_EDGE_R = "ASUS_TINKER_EDGE_R"

# Walnut Pi boards
WALNUT_PI_1B = "WALNUT_PI_1B"

# Clockwork Pi boards
CLOCKWORK_CPI3 = "CLOCKWORK_CPI3"

Expand Down Expand Up @@ -219,6 +222,9 @@
ASUS_TINKER_EDGE_R,
)

# WalnutPi
_WALNUT_PI_IDS = (WALNUT_PI_1B,)

# STM32MP1
_STM32MP1_IDS = (
STM32MP157C_DK2,
Expand Down
3 changes: 3 additions & 0 deletions bin/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,6 @@

if detector.board.any_nxp_navq_board:
print("NXP NavQ board detected.")

if detector.board.any_walnutpi:
print("Walnut Pi detected.")

0 comments on commit 95fb4af

Please sign in to comment.