Skip to content

Add Repka Pi-3 H5 and Pi-4 H6 constants #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,15 @@ def id(self) -> Optional[str]:
elif chip_id == chips.A64:
board_id = self._pine64_id()
elif chip_id == chips.H6:
board_id = self._pine64_id() or self._armbian_id()
board_id = (
self._pine64_id() or self._armbian_id() or self._repka_variants_id()
)
elif chip_id == chips.H5:
board_id = self._armbian_id() or self._allwinner_variants_id()
board_id = (
self._armbian_id()
or self._allwinner_variants_id()
or self._repka_variants_id()
)
elif chip_id == chips.H616:
board_id = self._armbian_id() or self._allwinner_variants_id()
elif chip_id == chips.A33:
Expand Down Expand Up @@ -420,6 +426,10 @@ def _armbian_id(self) -> Optional[str]:
board = boards.PCDUINO3
elif board_value == "rock-3a":
board = boards.ROCK_PI_3A
elif board_value == "repka-pi3-h5":
board = boards.REPKA_PI_3_H5
elif board_value == "repka-pi4-h6":
board = boards.REPKA_PI_4_H6
elif board_value == "milkv_duo":
board = boards.MILKV_DUO
return board
Expand Down Expand Up @@ -713,6 +723,19 @@ def _allwinner_variants_id(self) -> Optional[str]:
board = boards.OLIMEX_LIME2
return board

def _repka_variants_id(self) -> Optional[str]:
board_value = self.detector.get_device_model()
board = None
if not board_value:
return board
board_value = board_value.lower()
if "repka-pi3-h5" in board_value:
board = boards.REPKA_PI_3_H5
if "repka-pi4-h6" in board_value:
board = boards.REPKA_PI_4_H6

return board

# pylint: disable=too-many-return-statements

def _rp2040_u2if_id(self) -> Optional[str]:
Expand Down Expand Up @@ -948,6 +971,11 @@ def any_olimex_lime2_board(self):
"""Check whether the current board is any Pine64 device."""
return self.id in boards.OLIMEX_LIME2

@property
def any_repka_board(self):
"""Check whether the current board is any Repka device."""
return self.id in boards._REPKA_PI_IDS

@property
def os_environ_board(self) -> bool:
"""Check whether the current board is an OS environment variable special case."""
Expand Down Expand Up @@ -1011,6 +1039,7 @@ def lazily_generate_conditions():
yield self.any_nxp_navq_board
yield self.any_walnutpi
yield self.any_olimex_lime2_board
yield self.any_repka_board
yield self.any_milkv_board

return any(condition for condition in lazily_generate_conditions())
Expand Down
10 changes: 10 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,4 +563,14 @@

_NXP_SOM_IDS = (NXP_IMX8MPLUS_SOM,)

# Repka-Pi boards
REPKA_PI_3_H5 = "REPKA_PI_3_H5"
REPKA_PI_4_H6 = "REPKA_PI_4_H6"

# Repka-Pi
_REPKA_PI_IDS = (
REPKA_PI_3_H5,
REPKA_PI_4_H6,
)

_MILKV_IDS_ = (MILKV_DUO,)