Skip to content

Commit af15c57

Browse files
authored
Merge pull request #32 from makermelissa/master
Added Raspberry Pi CM3+ and Compute Module detection
2 parents eeb4be3 + 8a93e0c commit af15c57

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

adafruit_platformdetect/board.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
RASPBERRY_PI_3B_PLUS = "RASPBERRY_PI_3B_PLUS"
5353
RASPBERRY_PI_CM3 = "RASPBERRY_PI_CM3"
5454
RASPBERRY_PI_3A_PLUS = "RASPBERRY_PI_3A_PLUS"
55+
RASPBERRY_PI_CM3_PLUS = "RASPBERRY_PI_CM3_PLUS"
5556
RASPBERRY_PI_4B = "RASPBERRY_PI_4B"
5657

5758
ODROID_C1 = "ODROID_C1"
@@ -61,7 +62,7 @@
6162
FTDI_FT232H = "FT232H"
6263
DRAGONBOARD_410C = "DRAGONBOARD_410C"
6364

64-
SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"
65+
SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"
6566

6667
# pylint: enable=bad-whitespace
6768

@@ -94,6 +95,12 @@
9495
RASPBERRY_PI_4B
9596
)
9697

98+
_RASPBERRY_PI_CM_IDS = (
99+
RASPBERRY_PI_CM1,
100+
RASPBERRY_PI_CM3,
101+
RASPBERRY_PI_CM3_PLUS
102+
)
103+
97104
_ODROID_40_PIN_IDS = (
98105
ODROID_C1,
99106
ODROID_C1_PLUS,
@@ -259,6 +266,10 @@
259266
'9020e0',
260267
'19020e0', '29020e0', # warranty bits
261268
),
269+
RASPBERRY_PI_CM3_PLUS: (
270+
'a02100',
271+
'1a02100', '2a02100', # warranty bits
272+
),
262273
RASPBERRY_PI_4B: (
263274
'a03111', 'b03111', 'c03111',
264275
'1a03111', '2a03111', '1b03111', '2b03111', # warranty bits
@@ -419,6 +430,11 @@ def any_raspberry_pi_40_pin(self):
419430
"""Check whether the current board is any 40-pin Raspberry Pi."""
420431
return self.id in _RASPBERRY_PI_40_PIN_IDS
421432

433+
@property
434+
def any_raspberry_pi_cm(self):
435+
"""Check whether the current board is any Compute Module Raspberry Pi."""
436+
return self.id in _RASPBERRY_PI_CM_IDS
437+
422438
@property
423439
def any_beaglebone(self):
424440
"""Check whether the current board is any Beaglebone-family system."""

bin/detect.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
print("Is this a Pi 3B+?", detector.board.RASPBERRY_PI_3B_PLUS)
1313
print("Is this a Pi 4B?", detector.board.RASPBERRY_PI_4B)
1414
print("Is this a 40-pin Raspberry Pi?", detector.board.any_raspberry_pi_40_pin)
15+
print("Is this a Raspberry Pi Compute Module?", detector.board.any_raspberry_pi_cm)
1516
print("Is this a BBB?", detector.board.BEAGLEBONE_BLACK)
1617
print("Is this a Giant Board?", detector.board.GIANT_BOARD)
1718
print("Is this a Coral Edge TPU?", detector.board.CORAL_EDGE_TPU_DEV)

0 commit comments

Comments
 (0)