From ffaf56ceb62f6e49ed5ec0db680c86bf12ddd746 Mon Sep 17 00:00:00 2001 From: Brennen Bearnes Date: Thu, 20 Dec 2018 12:17:00 -0700 Subject: [PATCH 1/2] add 40-pin raspberry pi detection --- adafruit_platformdetect/board.py | 16 ++++++++++++++++ bin/detect.py | 1 + 2 files changed, 17 insertions(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 1334a62a..5109eab4 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -46,6 +46,17 @@ RASPBERRY_PI_3B_PLUS ) +ANY_RASPBERRY_PI_40PIN = ( + RASPBERRY_PI_B_PLUS, + RASPBERRY_PI_A_PLUS, + RASPBERRY_PI_ZERO, + RASPBERRY_PI_ZERO_W, + RASPBERRY_PI_2B, + RASPBERRY_PI_3B, + RASPBERRY_PI_3B_PLUS, + RASPBERRY_PI_3A_PLUS +) + # BeagleBone eeprom board ids from: # https://github.com/beagleboard/image-builder # Thanks to zmatt on freenode #beagle for pointers. @@ -219,6 +230,11 @@ def any_raspberry_pi_2_or_3(self): """Check whether the current board is any Raspberry Pi 2 or 3.""" return self.id in ANY_RASPBERRY_PI_2_OR_3 + @property + def any_raspberry_pi_40pin(self): + """Check whether the current board is any 40-pin Raspberry Pi.""" + return self.id in ANY_RASPBERRY_PI_40PIN + def __getattr__(self, attr): """ Detect whether the given attribute is the currently-detected board. See list diff --git a/bin/detect.py b/bin/detect.py index 82c592c0..cdc2ea09 100755 --- a/bin/detect.py +++ b/bin/detect.py @@ -9,6 +9,7 @@ print("Board id: ", detector.board.id) print("Is this a Pi 3B+?", detector.board.RASPBERRY_PI_3B_PLUS) +print("Is this a 40-pin Raspberry Pi?", detector.board.RASPBERRY_PI_3B_PLUS) print("Is this a BBB?", detector.board.BEAGLEBONE_BLACK) print("Is this an Orange Pi PC?", detector.board.ORANGE_PI_PC) print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC) From 5df844bc97e8937d7a44e2567f0183c08131f114 Mon Sep 17 00:00:00 2001 From: Brennen Bearnes Date: Thu, 20 Dec 2018 12:29:06 -0700 Subject: [PATCH 2/2] call correct 40pin property in detect.py --- bin/detect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/detect.py b/bin/detect.py index cdc2ea09..04b8f835 100755 --- a/bin/detect.py +++ b/bin/detect.py @@ -9,7 +9,7 @@ print("Board id: ", detector.board.id) print("Is this a Pi 3B+?", detector.board.RASPBERRY_PI_3B_PLUS) -print("Is this a 40-pin Raspberry Pi?", detector.board.RASPBERRY_PI_3B_PLUS) +print("Is this a 40-pin Raspberry Pi?", detector.board.any_raspberry_pi_40pin) print("Is this a BBB?", detector.board.BEAGLEBONE_BLACK) print("Is this an Orange Pi PC?", detector.board.ORANGE_PI_PC) print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)