Skip to content
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
17 changes: 16 additions & 1 deletion adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def id(self):
board_id = boards.FEATHER_HUZZAH
elif chip_id == chips.SAMD21:
board_id = boards.FEATHER_M0_EXPRESS
elif chip_id == chips.STM32:
elif chip_id == chips.STM32F405:
board_id = boards.PYBOARD
elif chip_id == chips.S805:
board_id = boards.ODROID_C1
Expand Down Expand Up @@ -125,6 +125,8 @@ def id(self):
board_id = self._udoo_id()
elif chip_id == chips.PENTIUM_N3710:
board_id = self._udoo_id()
elif chip_id == chips.STM32MP157:
board_id = self._stm32mp1_id()

return board_id

Expand Down Expand Up @@ -251,6 +253,13 @@ def _sama5_id(self):
return boards.GIANT_BOARD
return None

def _stm32mp1_id(self):
"""Check what type stm32mp1 board."""
board_value = self.detector.get_device_model()
if "STM32MP157C-DK2" in board_value:
return boards.STM32MP157C_DK2
return None

def _imx8mx_id(self):
"""Check what type iMX8M board."""
board_value = self.detector.get_device_model()
Expand Down Expand Up @@ -430,6 +439,11 @@ def any_asus_tinker_board(self):
"""Check to see if the current board is an ASUS Tinker Board"""
return self.id in boards._ASUS_TINKER_BOARD_IDS

@property
def any_stm32mp1(self):
"""Check whether the current board is any stm32mp1 board."""
return self.id in boards._STM32MP1_IDS

@property
def any_embedded_linux(self):
"""Check whether the current board is any embedded Linux device."""
Expand All @@ -451,6 +465,7 @@ def any_embedded_linux(self):
self.any_clockwork_pi_board,
self.any_udoo_board,
self.any_asus_tinker_board,
self.any_stm32mp1,
]
)

Expand Down
5 changes: 4 additions & 1 deletion adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def id(
if platform == "samd21":
return chips.SAMD21
if platform == "pyboard":
return chips.STM32
return chips.STM32F405
# nothing found!
return None

Expand All @@ -133,6 +133,9 @@ def _linux_id(self):
if self.detector.check_dt_compatible_value("rockchip,rk3288"):
return chips.RK3288

if self.detector.check_dt_compatible_value("st,stm32mp157"):
return chips.STM32MP157

linux_id = None
hardware = self.detector.get_cpuinfo_field("Hardware")

Expand Down
9 changes: 6 additions & 3 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Definition of boards and/or ids"""
# Allow for aligned constant definitions:
# pylint: disable=bad-whitespace
BEAGLEBONE = "BEAGLEBONE"
BEAGLEBONE_BLACK = "BEAGLEBONE_BLACK"
BEAGLEBONE_BLUE = "BEAGLEBONE_BLUE"
Expand Down Expand Up @@ -54,6 +53,9 @@
PYNQ_Z1 = "PYNQ_Z1"
PYNQ_Z2 = "PYNQ_Z2"

# STM32 MPU boards
STM32MP157C_DK2 = "STM32MP157C_DK2"

# Various Raspberry Pi models
RASPBERRY_PI_B_REV1 = "RASPBERRY_PI_B_REV1"
RASPBERRY_PI_B_REV2 = "RASPBERRY_PI_B_REV2"
Expand Down Expand Up @@ -104,11 +106,12 @@
UDOO_BOLT_V8 = "UDOO_BOLT_V8"
UDOO_X86 = "UDOO_X86"

# pylint: enable=bad-whitespace

# Asus Tinkerboard
_ASUS_TINKER_BOARD_IDS = (ASUS_TINKER_BOARD,)

# STM32MP1
_STM32MP1_IDS = (STM32MP157C_DK2,)

# OrangePI
_ORANGE_PI_IDS = (
ORANGE_PI_PC,
Expand Down
3 changes: 2 additions & 1 deletion adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
RYZEN_V1202B = "RYZEN_V1202B"
RYZEN_V1605B = "RYZEN_V1605B"
SAMD21 = "SAMD21"
STM32 = "STM32"
SUN8I = "SUN8I"
S805 = "S805"
S905 = "S905"
Expand All @@ -32,5 +31,7 @@
LPC4330 = "LPC4330"
RK3288 = "RK3288"
PENTIUM_N3710 = "PENTIUM_N3710" # SOC Braswell core
STM32F405 = "STM32F405"
STM32MP157 = "STM32MP157"

BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"}
1 change: 1 addition & 0 deletions bin/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)
print("Is this a UDOO Bolt?", detector.board.UDOO_BOLT)
print("Is this an ASUS Tinker Board?", detector.board.ASUS_TINKER_BOARD)
print("Is this an STM32MP1 Board?", detector.board.any_stm32mp1)
print(
"Is this an OS environment variable special case?",
detector.board.FTDI_FT232H
Expand Down