You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.0 KiB

  1. Introduction
  2. ============
  3. This library provides best-guess platform detection for a range of single-board
  4. computers and (potentially) other platforms. It was written primarily for use
  5. in `Adafruit_Blinka <https://github.com/adafruit/Adafruit_Blinka>`_, but may be
  6. useful in other contexts.
  7. Platform detection is divided into "chip" and "board" detection, with the latter
  8. generally dependent on the former. Platform info is gathered from:
  9. - Python's `sys.platform`
  10. - Various files on Linux systems:
  11. - `/proc/cpuinfo` (for processor info, Raspberry Pi hardware revisions, etc.)
  12. - `/proc/device-tree/compatible` (for 96Boards info)
  13. - Beaglebone EEPROM board IDs
  14. - Distribution-specific files such as `/etc/armbian-release`.
  15. The API is currently unstable and may change drastically in future releases.
  16. Installation
  17. ============
  18. On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
  19. PyPI <https://pypi.org/project/adafruit-circuitpython-motorkit/>`_. To install for current user:
  20. .. code-block:: shell
  21. pip3 install Adafruit-PlatformDetect
  22. To install system-wide (this may be required in some cases):
  23. .. code-block:: shell
  24. sudo pip3 install Adafruit-PlatformDetect
  25. To install in a virtual environment in your current project:
  26. .. code-block:: shell
  27. mkdir project-name && cd project-name
  28. python3 -m venv .env
  29. source .env/bin/activate
  30. pip3 install Adafruit-PlatformDetect
  31. Usage
  32. =====
  33. .. code-block:: python
  34. from adafruit_platformdetect import Detector
  35. detector = Detector()
  36. print("Chip id: ", detector.chip.id)
  37. print("Board id: ", detector.board.id)
  38. # Check for specific board models:
  39. print("Pi 3B+? ", detector.board.RASPBERRY_PI_3B_PLUS)
  40. print("BBB? ", detector.board.BEAGLEBONE_BLACK)
  41. print("Orange Pi PC? ", detector.board.ORANGE_PI_PC)
  42. print("generic Linux PC? ", detector.board.GENERIC_LINUX_PC)
  43. See https://github.com/adafruit/Adafruit_Python_PlatformDetect/blob/master/bin/detect.py for more possible detectable boards