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.

62 lines
1.8 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. - The `/proc/cpuinfo` file on Linux systems (for processor info, Raspberry Pi
  11. hardware revisions, etc.)
  12. - Beaglebone EEPROM board IDs
  13. - Distribution-specific files such as `/etc/armbian-release`.
  14. The API is currently unstable and may change drastically in future releases.
  15. Installation
  16. ============
  17. On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
  18. PyPI <https://pypi.org/project/adafruit-circuitpython-motorkit/>`_. To install for current user:
  19. .. code-block:: shell
  20. pip3 install Adafruit-PlatformDetect
  21. To install system-wide (this may be required in some cases):
  22. .. code-block:: shell
  23. sudo pip3 install Adafruit-PlatformDetect
  24. To install in a virtual environment in your current project:
  25. .. code-block:: shell
  26. mkdir project-name && cd project-name
  27. python3 -m venv .env
  28. source .env/bin/activate
  29. pip3 install Adafruit-PlatformDetect
  30. Usage
  31. =====
  32. .. code-block:: python
  33. from adafruit_platformdetect import Detector
  34. detector = Detector()
  35. print("Chip id: ", detector.chip.id)
  36. print("Board id: ", detector.board.id)
  37. # Check for specific board models:
  38. print("Pi 3B+? ", detector.board.RASPBERRY_PI_3B_PLUS)
  39. print("BBB? ", detector.board.BEAGLEBONE_BLACK)
  40. print("Orange Pi PC? ", detector.board.ORANGE_PI_PC)
  41. print("generic Linux PC? ", detector.board.GENERIC_LINUX_PC)