Skip to content

Commit cf93300

Browse files
authored
Merge pull request #283 from McFly-Labs/main
Adding NXP NavQPlus to detected boards
2 parents 2477c89 + 61b2ae2 commit cf93300

File tree

6 files changed

+28
-0
lines changed

6 files changed

+28
-0
lines changed

adafruit_platformdetect/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
if sys.platform == "darwin":
2222
os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib/"
2323

24+
2425
# Various methods here may retain state in future, so tell pylint not to worry
2526
# that they don't use self right now:
2627
# pylint: disable=no-self-use

adafruit_platformdetect/board.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def id(self) -> Optional[str]:
8181
board_id = self._sama5_id()
8282
elif chip_id == chips.IMX8MX:
8383
board_id = self._imx8mx_id()
84+
elif chip_id == chips.IMX8MP:
85+
board_id = self._imx8mp_id()
8486
elif chip_id == chips.IMX6ULL:
8587
board_id = self._imx6ull_id()
8688
elif chip_id == chips.S905Y2:
@@ -420,6 +422,13 @@ def _imx8mx_id(self) -> Optional[str]:
420422
return boards.CORAL_EDGE_TPU_DEV
421423
return None
422424

425+
def _imx8mp_id(self) -> Optional[str]:
426+
"""Check what type iMX8M board."""
427+
board_value = self.detector.get_device_model()
428+
if "NXP i.MX8MPlus SOM" in board_value:
429+
return boards.NXP_IMX8MPLUS_SOM
430+
return None
431+
423432
def _imx6ull_id(self) -> Optional[str]:
424433
"""Check what type iMX6ULL board."""
425434
board_value = self.detector.get_device_model()
@@ -797,6 +806,11 @@ def any_libre_computer_board(self) -> bool:
797806
"""Check whether the current board is any defined Libre Computer board."""
798807
return self.id in boards._LIBRE_COMPUTER_IDS
799808

809+
@property
810+
def any_nxp_navq_board(self) -> bool:
811+
"""Check whether the current board is any NXP NavQ board"""
812+
return self.id in boards._NXP_SOM_IDS
813+
800814
@property
801815
def os_environ_board(self) -> bool:
802816
"""Check whether the current board is an OS environment variable special case."""
@@ -851,6 +865,7 @@ def lazily_generate_conditions():
851865
yield self.any_pcduino_board
852866
yield self.any_libre_computer_board
853867
yield self.generic_linux
868+
yield self.any_nxp_navq_board
854869

855870
return any(condition for condition in lazily_generate_conditions())
856871

adafruit_platformdetect/chip.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ def _linux_id(self) -> Optional[str]:
269269
if self.detector.check_dt_compatible_value("sun20i-d1"):
270270
return chips.D1_RISCV
271271

272+
if self.detector.check_dt_compatible_value("imx8mp"):
273+
return chips.IMX8MP
274+
272275
if self.detector.check_dt_compatible_value("libretech,aml-s905x-cc"):
273276
return chips.S905X
274277

adafruit_platformdetect/constants/boards.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,3 +585,8 @@
585585
AML_S905X_CC,
586586
ROC_RK3328_CC,
587587
)
588+
589+
# NXP System on Module Computer boards
590+
NXP_IMX8MPLUS_SOM = "NXP_IMX8MPLUS_SOM"
591+
592+
_NXP_SOM_IDS = (NXP_IMX8MPLUS_SOM,)

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
TDA4VM = "TDA4VM"
1111
IMX6ULL = "IMX6ULL"
1212
IMX8MX = "IMX8MX"
13+
IMX8MP = "IMX8MP"
1314
BCM2XXX = "BCM2XXX"
1415
ESP8266 = "ESP8266"
1516
EXYNOS5422 = "EXYNOS5422"

bin/detect.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,6 @@
111111

112112
if detector.board.any_siemens_simatic_iot2000:
113113
print("Siemens Simatic IOT2000 Gateway detected.")
114+
115+
if detector.board.any_nxp_navq_board:
116+
print("NXP NavQ board detected.")

0 commit comments

Comments
 (0)