Skip to content

Commit bb8e698

Browse files
authored
Merge pull request #3 from adafruit/40pin
add 40-pin raspberry pi detection
2 parents a97afcd + 5df844b commit bb8e698

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@
4646
RASPBERRY_PI_3B_PLUS
4747
)
4848

49+
ANY_RASPBERRY_PI_40PIN = (
50+
RASPBERRY_PI_B_PLUS,
51+
RASPBERRY_PI_A_PLUS,
52+
RASPBERRY_PI_ZERO,
53+
RASPBERRY_PI_ZERO_W,
54+
RASPBERRY_PI_2B,
55+
RASPBERRY_PI_3B,
56+
RASPBERRY_PI_3B_PLUS,
57+
RASPBERRY_PI_3A_PLUS
58+
)
59+
4960
# BeagleBone eeprom board ids from:
5061
# https://github.com/beagleboard/image-builder
5162
# Thanks to zmatt on freenode #beagle for pointers.
@@ -219,6 +230,11 @@ def any_raspberry_pi_2_or_3(self):
219230
"""Check whether the current board is any Raspberry Pi 2 or 3."""
220231
return self.id in ANY_RASPBERRY_PI_2_OR_3
221232

233+
@property
234+
def any_raspberry_pi_40pin(self):
235+
"""Check whether the current board is any 40-pin Raspberry Pi."""
236+
return self.id in ANY_RASPBERRY_PI_40PIN
237+
222238
def __getattr__(self, attr):
223239
"""
224240
Detect whether the given attribute is the currently-detected board. See list

bin/detect.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
print("Board id: ", detector.board.id)
1010

1111
print("Is this a Pi 3B+?", detector.board.RASPBERRY_PI_3B_PLUS)
12+
print("Is this a 40-pin Raspberry Pi?", detector.board.any_raspberry_pi_40pin)
1213
print("Is this a BBB?", detector.board.BEAGLEBONE_BLACK)
1314
print("Is this an Orange Pi PC?", detector.board.ORANGE_PI_PC)
1415
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)

0 commit comments

Comments
 (0)