Adafruit_Python_PlatformDetect/bin/detect.py
Brennen Bearnes 0c491f95a2 refactor board detection to dependent on chip; simplify getattr checking
Per feedback here and elsewhere:

https://forum.armbian.com/topic/8981-adafruit-circuitpython/?tab=comments#comment-67633

There's still plenty to be done here, but this is cleaner than it was.

Also makes some names more consistent, and uses uppercase string values for id
constants.
2018-12-11 14:25:36 -07:00

19 lines
488 B
Python

#!/usr/bin/env python3
import adafruit_platformdetect
detect = adafruit_platformdetect.PlatformDetect()
print("Chip id: ", detect.chip.id)
print("Board id: ", detect.board.id)
print("Is this a Pi 3B+?", detect.board.RASPBERRY_PI_3B_PLUS)
print("Is this a BBB?", detect.board.BEAGLEBONE_BLACK)
if detect.board.any_raspberry_pi:
print("Raspberry Pi detected.")
print("Revision code: ", detect.board._pi_rev_code())
if detect.board.beaglebone_black:
print("BBB detected")