Skip to content

add 40-pin raspberry pi detection #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions bin/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.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)
Expand Down