Browse Source

Added Raspberry Pi CM3+ and Compute Module detection

Melissa LeBlanc-Williams 1 month ago
parent
commit
f891313e7d
2 changed files with 18 additions and 1 deletions
  1. 17
    1
      adafruit_platformdetect/board.py
  2. 1
    0
      bin/detect.py

+ 17
- 1
adafruit_platformdetect/board.py View File

@@ -52,6 +52,7 @@ RASPBERRY_PI_3B             = "RASPBERRY_PI_3B"
52 52
 RASPBERRY_PI_3B_PLUS        = "RASPBERRY_PI_3B_PLUS"
53 53
 RASPBERRY_PI_CM3            = "RASPBERRY_PI_CM3"
54 54
 RASPBERRY_PI_3A_PLUS        = "RASPBERRY_PI_3A_PLUS"
55
+RASPBERRY_PI_CM3_PLUS       = "RASPBERRY_PI_CM3_PLUS"
55 56
 RASPBERRY_PI_4B             = "RASPBERRY_PI_4B"
56 57
 
57 58
 ODROID_C1                   = "ODROID_C1"
@@ -61,7 +62,7 @@ ODROID_C2                   = "ODROID_C2"
61 62
 FTDI_FT232H                 = "FT232H"
62 63
 DRAGONBOARD_410C            = "DRAGONBOARD_410C"
63 64
 
64
-SIFIVE_UNLEASHED                = "SIFIVE_UNLEASHED"
65
+SIFIVE_UNLEASHED            = "SIFIVE_UNLEASHED"
65 66
 
66 67
 # pylint: enable=bad-whitespace
67 68
 
@@ -94,6 +95,12 @@ _RASPBERRY_PI_40_PIN_IDS = (
94 95
     RASPBERRY_PI_4B
95 96
 )
96 97
 
98
+_RASPBERRY_PI_CM_IDS = (
99
+    RASPBERRY_PI_CM1,
100
+    RASPBERRY_PI_CM3,
101
+    RASPBERRY_PI_CM3_PLUS
102
+)
103
+
97 104
 _ODROID_40_PIN_IDS = (
98 105
     ODROID_C1,
99 106
     ODROID_C1_PLUS,
@@ -259,6 +266,10 @@ _PI_REV_CODES = {
259 266
         '9020e0',
260 267
         '19020e0', '29020e0', # warranty bits
261 268
     ),
269
+    RASPBERRY_PI_CM3_PLUS: (
270
+       'a02100',
271
+       '1a02100', '2a02100', # warranty bits
272
+   ),
262 273
     RASPBERRY_PI_4B: (
263 274
         'a03111', 'b03111', 'c03111',
264 275
         '1a03111', '2a03111', '1b03111', '2b03111', # warranty bits
@@ -420,6 +431,11 @@ class Board:
420 431
         return self.id in _RASPBERRY_PI_40_PIN_IDS
421 432
 
422 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
+    
438
+    @property
423 439
     def any_beaglebone(self):
424 440
         """Check whether the current board is any Beaglebone-family system."""
425 441
         return self.id in _BEAGLEBONE_IDS

+ 1
- 0
bin/detect.py View File

@@ -12,6 +12,7 @@ print("Is this a DragonBoard 410c?", detector.board.DRAGONBOARD_410C)
12 12
 print("Is this a Pi 3B+?", detector.board.RASPBERRY_PI_3B_PLUS)
13 13
 print("Is this a Pi 4B?", detector.board.RASPBERRY_PI_4B)
14 14
 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)
15 16
 print("Is this a BBB?", detector.board.BEAGLEBONE_BLACK)
16 17
 print("Is this a Giant Board?", detector.board.GIANT_BOARD)
17 18
 print("Is this a Coral Edge TPU?", detector.board.CORAL_EDGE_TPU_DEV)

Loading…
Cancel
Save