|
| 1 | +Introduction |
| 2 | +============ |
| 3 | + |
| 4 | +This library provides best-guess platform detection for a range of single-board |
| 5 | +computers and (potentially) other platforms. It's intended for use in |
| 6 | +`Adafruit_Blinka <https://github.com/adafruit/Adafruit_Blinka>`_, but may be |
| 7 | +useful in other contexts. |
| 8 | + |
| 9 | +The API is currently unstable and may change drastically in future releases. |
| 10 | + |
| 11 | +Installation |
| 12 | +============ |
| 13 | + |
| 14 | +On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from |
| 15 | +PyPI <https://pypi.org/project/adafruit-circuitpython-motorkit/>`_. To install for current user: |
| 16 | + |
| 17 | +.. code-block:: shell |
| 18 | +
|
| 19 | + pip3 install Adafruit-PlatformDetect |
| 20 | +
|
| 21 | +To install system-wide (this may be required in some cases): |
| 22 | + |
| 23 | +.. code-block:: shell |
| 24 | +
|
| 25 | + sudo pip3 install Adafruit-PlatformDetect |
| 26 | +
|
| 27 | +To install in a virtual environment in your current project: |
| 28 | + |
| 29 | +.. code-block:: shell |
| 30 | +
|
| 31 | + mkdir project-name && cd project-name |
| 32 | + python3 -m venv .env |
| 33 | + source .env/bin/activate |
| 34 | + pip3 install Adafruit-PlatformDetect |
| 35 | +
|
| 36 | +Usage |
| 37 | +===== |
| 38 | + |
| 39 | +.. code-block:: python |
| 40 | +
|
| 41 | + from adafruit_platformdetect import Detector |
| 42 | + detector = Detector() |
| 43 | + print("Chip id: ", detector.chip.id) |
| 44 | + print("Board id: ", detector.board.id) |
| 45 | +
|
| 46 | + # Check for specific board models: |
| 47 | + print("Pi 3B+? ", detector.board.RASPBERRY_PI_3B_PLUS) |
| 48 | + print("BBB? ", detector.board.BEAGLEBONE_BLACK) |
| 49 | + print("Orange Pi PC? ", detector.board.ORANGE_PI_PC) |
| 50 | + print("generic Linux PC? ", detector.board.GENERIC_LINUX_PC) |
0 commit comments