Skip to content

Commit a107fe7

Browse files
authored
Merge pull request #21 from ladyada/master
Google Coral Dev board
2 parents cddd4d4 + 56fdb9e commit a107fe7

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

adafruit_platformdetect/board.py

+18
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@
2828
ORANGE_PI_PC = "ORANGE_PI_PC"
2929
GIANT_BOARD = "GIANT_BOARD"
3030

31+
# NVIDIA Jetson boards
3132
JETSON_TX1 = 'JETSON_TX1'
3233
JETSON_TX2 = 'JETSON_TX2'
3334
JETSON_XAVIER = 'JETSON_XAVIER'
3435
JETSON_NANO = 'JETSON_NANO'
3536

37+
# Google Coral dev board
38+
CORAL_EDGE_TPU_DEV = "CORAL_EDGE_TPU_DEV"
39+
40+
# Various Raspberry Pi models
3641
RASPBERRY_PI_B_REV1 = "RASPBERRY_PI_B_REV1"
3742
RASPBERRY_PI_B_REV2 = "RASPBERRY_PI_B_REV2"
3843
RASPBERRY_PI_B_PLUS = "RASPBERRY_PI_B_PLUS"
@@ -54,6 +59,10 @@
5459
FTDI_FT232H = "FT232H"
5560
# pylint: enable=bad-whitespace
5661

62+
_CORAL_IDS = (
63+
CORAL_EDGE_TPU_DEV,
64+
)
65+
5766
_JETSON_IDS = (
5867
JETSON_TX1,
5968
JETSON_TX2,
@@ -259,6 +268,8 @@ def id(self):
259268
board_id = self._armbian_id()
260269
elif chip_id == ap_chip.SAMA5:
261270
board_id = self._sama5_id()
271+
elif chip_id == ap_chip.IMX8MX:
272+
board_id = self._imx8mx_id()
262273
elif chip_id == ap_chip.ESP8266:
263274
board_id = FEATHER_HUZZAH
264275
elif chip_id == ap_chip.SAMD21:
@@ -332,6 +343,13 @@ def _sama5_id(self):
332343
return GIANT_BOARD
333344
return None
334345

346+
def _imx8mx_id(self):
347+
"""Check what type iMX8M board."""
348+
board_value = self.detector.get_device_model()
349+
if "Phanbell" in board_value:
350+
return CORAL_EDGE_TPU_DEV
351+
return None
352+
335353
def _tegra_id(self):
336354
"""Try to detect the id of aarch64 board."""
337355
board_value = self.detector.get_device_model()

adafruit_platformdetect/chip.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44

55
AM33XX = "AM33XX"
6+
IMX8MX = "IMX8MX"
67
BCM2XXX = "BCM2XXX"
78
ESP8266 = "ESP8266"
89
SAMD21 = "SAMD21"
@@ -70,7 +71,7 @@ def id(self): # pylint: disable=invalid-name,too-many-branches,too-many-return-s
7071
return None
7172
# pylint: enable=invalid-name
7273

73-
def _linux_id(self):
74+
def _linux_id(self): # pylint: disable=too-many-branches
7475
"""Attempt to detect the CPU on a computer running the Linux kernel."""
7576
linux_id = None
7677

@@ -89,6 +90,9 @@ def _linux_id(self):
8990
linux_id = T186
9091
elif 'xavier' in compatible:
9192
linux_id = T194
93+
if compatible and 'imx8m' in compatible:
94+
linux_id = IMX8MX
95+
9296
elif hardware in ("BCM2708", "BCM2709", "BCM2835"):
9397
linux_id = BCM2XXX
9498
elif "AM33XX" in hardware:

bin/detect.py

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
print("Is this a BBB?", detector.board.BEAGLEBONE_BLACK)
1414
print("Is this an Orange Pi PC?", detector.board.ORANGE_PI_PC)
1515
print("Is this a Giant Board?", detector.board.GIANT_BOARD)
16+
print("Is this a Coral Edge TPU?", detector.board.CORAL_EDGE_TPU_DEV)
1617
print("Is this an embedded Linux system?", detector.board.any_embedded_linux)
1718
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)
1819

0 commit comments

Comments
 (0)