Skip to content

Commit

Permalink
Merge pull request #283 from McFly-Labs/main
Browse files Browse the repository at this point in the history
Adding NXP NavQPlus to detected boards
  • Loading branch information
makermelissa authored Mar 17, 2023
2 parents 2477c89 + 61b2ae2 commit cf93300
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions adafruit_platformdetect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
if sys.platform == "darwin":
os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib/"


# Various methods here may retain state in future, so tell pylint not to worry
# that they don't use self right now:
# pylint: disable=no-self-use
Expand Down
15 changes: 15 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def id(self) -> Optional[str]:
board_id = self._sama5_id()
elif chip_id == chips.IMX8MX:
board_id = self._imx8mx_id()
elif chip_id == chips.IMX8MP:
board_id = self._imx8mp_id()
elif chip_id == chips.IMX6ULL:
board_id = self._imx6ull_id()
elif chip_id == chips.S905Y2:
Expand Down Expand Up @@ -420,6 +422,13 @@ def _imx8mx_id(self) -> Optional[str]:
return boards.CORAL_EDGE_TPU_DEV
return None

def _imx8mp_id(self) -> Optional[str]:
"""Check what type iMX8M board."""
board_value = self.detector.get_device_model()
if "NXP i.MX8MPlus SOM" in board_value:
return boards.NXP_IMX8MPLUS_SOM
return None

def _imx6ull_id(self) -> Optional[str]:
"""Check what type iMX6ULL board."""
board_value = self.detector.get_device_model()
Expand Down Expand Up @@ -797,6 +806,11 @@ def any_libre_computer_board(self) -> bool:
"""Check whether the current board is any defined Libre Computer board."""
return self.id in boards._LIBRE_COMPUTER_IDS

@property
def any_nxp_navq_board(self) -> bool:
"""Check whether the current board is any NXP NavQ board"""
return self.id in boards._NXP_SOM_IDS

@property
def os_environ_board(self) -> bool:
"""Check whether the current board is an OS environment variable special case."""
Expand Down Expand Up @@ -851,6 +865,7 @@ def lazily_generate_conditions():
yield self.any_pcduino_board
yield self.any_libre_computer_board
yield self.generic_linux
yield self.any_nxp_navq_board

return any(condition for condition in lazily_generate_conditions())

Expand Down
3 changes: 3 additions & 0 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ def _linux_id(self) -> Optional[str]:
if self.detector.check_dt_compatible_value("sun20i-d1"):
return chips.D1_RISCV

if self.detector.check_dt_compatible_value("imx8mp"):
return chips.IMX8MP

if self.detector.check_dt_compatible_value("libretech,aml-s905x-cc"):
return chips.S905X

Expand Down
5 changes: 5 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,3 +585,8 @@
AML_S905X_CC,
ROC_RK3328_CC,
)

# NXP System on Module Computer boards
NXP_IMX8MPLUS_SOM = "NXP_IMX8MPLUS_SOM"

_NXP_SOM_IDS = (NXP_IMX8MPLUS_SOM,)
1 change: 1 addition & 0 deletions adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
TDA4VM = "TDA4VM"
IMX6ULL = "IMX6ULL"
IMX8MX = "IMX8MX"
IMX8MP = "IMX8MP"
BCM2XXX = "BCM2XXX"
ESP8266 = "ESP8266"
EXYNOS5422 = "EXYNOS5422"
Expand Down
3 changes: 3 additions & 0 deletions bin/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,6 @@

if detector.board.any_siemens_simatic_iot2000:
print("Siemens Simatic IOT2000 Gateway detected.")

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

0 comments on commit cf93300

Please sign in to comment.