Compare commits

..

No commits in common. "main" and "96boards" have entirely different histories.

36 changed files with 562 additions and 4480 deletions

View file

@ -1,18 +0,0 @@
# SPDX-FileCopyrightText: 2023 Melissa LeBlanc-Williams, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
categories:
- title: "New Boards"
collapse-after: 1
labels:
- "New Board"
change-template: "- $TITLE #$NUMBER by @$AUTHOR"
template: |
## What's Changed
$CHANGES
To use in CPython, `pip3 install Adafruit-PlatformDetect`.
Read the [docs](https://circuitpython.readthedocs.io/projects/platformdetect/en/latest/) for info on how to use it.

View file

@ -1,64 +0,0 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Build CI
on: [pull_request, push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v3
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install dependencies
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
run: |
source actions-ci/install.sh
- name: Pip install Sphinx, pre-commit
run: |
pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
- name: Library version
run: git describe --dirty --always --tags
- name: Setup problem matchers
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1
- name: Pre-commit hooks
run: |
pre-commit run --all-files
- name: Build docs
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
- name: Check For pyproject.toml
id: need-pypi
run: |
echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT
- name: Build Python package
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
run: |
pip install --upgrade build setuptools wheel twine readme_renderer testresources
find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/1.2.3/" {} +
python -m build
twine check dist/*

View file

@ -1,25 +0,0 @@
# SPDX-FileCopyrightText: 2023 Melissa LeBlanc-Williams, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Release Drafter
on:
push:
branches:
- main
permissions:
contents: read
jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
pull-requests: read
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,38 +0,0 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Release Actions
on:
release:
types: [published]
jobs:
upload-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check For pyproject.toml
id: need-pypi
run: |
echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT
- name: Set up Python
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
run: |
python -m pip install --upgrade pip
pip install --upgrade build twine
- name: Build and publish
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" {} +
python -m build
twine upload dist/*

6
.gitignore vendored
View file

@ -1,14 +1,10 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
*.mpy
.idea
__pycache__
_build
build
*.pyc
.env
build*
bundles
*.DS_Store
.eggs

View file

@ -1,42 +0,0 @@
# SPDX-FileCopyrightText: 2020 Adafruit
#
# SPDX-License-Identifier: Unlicense
repos:
- repo: https://github.com/python/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: v1.1.2
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/pylint
rev: v2.17.4
hooks:
- id: pylint
name: pylint (library code)
types: [python]
args:
- --disable=consider-using-f-string,duplicate-code
exclude: "^(docs/|examples/|tests/|setup.py$)"
- id: pylint
name: pylint (example code)
description: Run pylint rules on "examples/*.py" files
types: [python]
files: "^examples/"
args:
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
- id: pylint
name: pylint (test code)
description: Run pylint rules on "tests/*.py" files
types: [python]
files: "^tests/"
args:
- --disable=missing-docstring,consider-using-f-string,duplicate-code

399
.pylintrc
View file

@ -1,399 +0,0 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=hid
# Add files or directories to the ignore-list. They should be base names, not
# paths.
ignore=CVS
# Add files or directories matching the regex patterns to the ignore-list. The
# regex matches against base names, not paths.
ignore-patterns=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint.
jobs=1
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=pylint.extensions.no_self_use
# Pickle collected data for later comparisons.
persistent=yes
# Specify a configuration file.
#rcfile=
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
confidence=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# disable=import-error,raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,deprecated-str-translate-call
disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,pointless-string-statement,unspecified-encoding,import-outside-toplevel,too-many-branches,too-many-statements,too-many-public-methods
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=
[REPORTS]
# Python expression which should return a note less than 10 (10 is the highest
# note). You have access to the variables errors warning, statement which
# respectively contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
#msg-template=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio).You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=text
# Tells whether to display a full report or only the messages
reports=no
# Activate the evaluation score.
score=yes
[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=5
[LOGGING]
# Logging modules to check that the string format arguments are in logging
# function parameter format
logging-modules=logging
[SPELLING]
# Spelling dictionary name. Available dictionaries: none. To make it working
# install python-enchant package.
spelling-dict=
# List of comma separated words that should not be checked.
spelling-ignore-words=
# A path to a file that contains private dictionary; one word per line.
spelling-private-dict-file=
# Tells whether to store unknown words to indicated private dictionary in
# --spelling-private-dict-file option instead of raising a message.
spelling-store-unknown-words=no
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
# notes=FIXME,XXX,TODO
notes=FIXME,XXX
[TYPECHECK]
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
[VARIABLES]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,_cb
# A regular expression matching the name of dummy variables (i.e. expectedly
# not used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
# Argument names that match this expression will be ignored. Default to name
# with leading underscore
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,future.builtins
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
# expected-line-ending-format=
expected-line-ending-format=LF
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=100
# Maximum number of lines in a module
max-module-lines=1000
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[SIMILARITIES]
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=yes
# Minimum lines number of a similarity.
min-similarity-lines=12
[BASIC]
# Regular expression matching correct argument names
argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct attribute names
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata
# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Regular expression matching correct class names
# class-rgx=[A-Z_][a-zA-Z0-9]+$
class-rgx=[A-Z_][a-zA-Z0-9_]+$
# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# Regular expression matching correct function names
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Good variable names which should always be accepted, separated by a comma
# good-names=i,j,k,ex,Run,_
good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
# Include a hint for the correct naming format with invalid-name
include-naming-hint=no
# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Regular expression matching correct method names
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty
# Regular expression matching correct variable names
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
[IMPORTS]
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Deprecated modules which should not be used, separated by a comma
deprecated-modules=optparse,tkinter.tix
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled)
ext-import-graph=
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled)
import-graph=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled)
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,_fields,_replace,_source,_make
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=mcs
[DESIGN]
# Maximum number of arguments for function / method
max-args=5
# Maximum number of attributes for a class (see R0902).
# max-attributes=7
max-attributes=11
# Maximum number of boolean expressions in a if statement
max-bool-expr=5
# Maximum number of branch for function / method body
max-branches=12
# Maximum number of locals for function / method body
max-locals=15
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# Maximum number of return / yield for function / method body
max-returns=6
# Maximum number of statements in function / method body
max-statements=50
# Minimum number of public methods for a class (see R0903).
min-public-methods=1
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=builtins.Exception

View file

@ -1,19 +0,0 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
build:
os: "ubuntu-20.04"
tools:
python: "3.7"
python:
install:
- requirements: docs/requirements.txt
- requirements: requirements.txt

27
.travis.yml Executable file
View file

@ -0,0 +1,27 @@
dist: trusty
sudo: false
language: python
python:
- "3.6"
cache:
pip: true
deploy:
- provider: pypi
user: adafruit-travis
password:
secure:
"cuXaREGKMzcM6684fDp5CeHOANcay4Lylfl3g3tU5Pcx2bxqj7oOZ+N/GMEG2KhJPofPcXky75tyBh8PVVcwrpkUeZgmb3Cyny4SdnKOoazdyhFI8wwqeMh2KLXcZXbC49Bg6iFDxr+PPzWkzqCsGa3XKIxdCmGDwdElBSuMpcTA+/GR588R/7F4UDGaNqdhpKk1csNYQ94gP6Hil4op9Ouw0hy5rKMBo79UvnoFdoMQiYQvZFlRSUvNbfcoECPoJnoNjPCwwDl5GVR1+ohU1xPkPFUj1aaj/rUaH1AXWlHYtHtwUsc54UP4VpSNV4qgQ3+AtHe0rhos9ZoPq/+f5LTlQ4bjAUbqWJCr3bIooTIBMc3c5sWxTBQIduMrJ5MkAs0m4ZS5KBu8ReiczP3v9XoI60hcZSZ1Uq63L9O8/LyTe484et9/CgmU5uN8dJdpTp+017GzgP8dT7xoWnxxgnBqdRlJ0rjhrPTk4T6d9OYzCJguitgmZOYx9GVLE2E8/c+r0ybxutcG0w3EI2+TZzWBxS+kUgQhCFL07PTZ5jMCBcJlvzzhphN+7IuUlecQJKHgRd450TxS3qcj+CQtWvCr/SvfhC6HJWE7uEqviJxV7kBvYxoUX0XQYeOzC6Ah4WH09fKccXbdhOoV5APWpb7Pa74XJWZrcKZuHuYtvlc="
on:
tags: true
install:
- pip install -r requirements.txt
- pip install --force-reinstall pylint==1.9.2
- pip install circuitpython-build-tools Sphinx sphinx-rtd-theme
script:
- pylint adafruit_platformdetect/**.py
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py)
# - cd docs && sphinx-build -E -W -b html . _build/html && cd ..

View file

@ -1,135 +1,74 @@
<!--
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
SPDX-License-Identifier: CC-BY-4.0
-->
# Adafruit Community Code of Conduct
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and leaders pledge to making participation in our project and
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level or type of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
We are committed to providing a friendly, safe and welcoming environment for
all.
Examples of behavior that contributes to creating a positive environment
include:
* Be kind and courteous to others
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Collaborating with other community members
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and sexual attention or advances
* The use of inappropriate images, including in a community member's avatar
* The use of inappropriate language, including in a community member's nickname
* Any spamming, flaming, baiting or other attention-stealing behavior
* Excessive or unwelcome helping; answering outside the scope of the question
asked
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Promoting or spreading disinformation, lies, or conspiracy theories against
a person, group, organisation, project, or community
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate
The goal of the standards and moderation guidelines outlined here is to build
and maintain a respectful community. We ask that you dont just aim to be
"technically unimpeachable", but rather try to be your best self.
We value many things beyond technical expertise, including collaboration and
supporting others within our community. Providing a positive experience for
other community members can have a much more significant impact than simply
providing the correct answer.
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project leaders are responsible for clarifying the standards of acceptable
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project leaders have the right and responsibility to remove, edit, or
reject messages, comments, commits, code, issues, and other contributions
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any community member for other behaviors that they deem
inappropriate, threatening, offensive, or harmful.
## Moderation
Instances of behaviors that violate the Adafruit Community Code of Conduct
may be reported by any member of the community. Community members are
encouraged to report these situations, including situations they witness
involving other community members.
You may report in the following ways:
In any situation, you may send an email to <support@adafruit.com>.
On the Adafruit Discord, you may send an open message from any channel
to all Community Moderators by tagging @community moderators. You may
also send an open message from any channel, or a direct message to
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
Email and direct message reports will be kept confidential.
In situations on Discord where the issue is particularly egregious, possibly
illegal, requires immediate action, or violates the Discord terms of service,
you should also report the message directly to Discord.
These are the steps for upholding our communitys standards of conduct.
1. Any member of the community may report any situation that violates the
Adafruit Community Code of Conduct. All reports will be reviewed and
investigated.
2. If the behavior is an egregious violation, the community member who
committed the violation may be banned immediately, without warning.
3. Otherwise, moderators will first respond to such behavior with a warning.
4. Moderators follow a soft "three strikes" policy - the community member may
be given another chance, if they are receptive to the warning and change their
behavior.
5. If the community member is unreceptive or unreasonable when warned by a
moderator, or the warning goes unheeded, they may be banned for a first or
second offense. Repeated offenses will result in the community member being
banned.
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct and the enforcement policies listed above apply to all
Adafruit Community venues. This includes but is not limited to any community
spaces (both public and private), the entire Adafruit Discord server, and
Adafruit GitHub repositories. Examples of Adafruit Community spaces include
but are not limited to meet-ups, audio chats on the Adafruit Discord, or
interaction at a conference.
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. As a community
member, you are representing our community, and are expected to behave
accordingly.
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at support@adafruit.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
For other projects adopting the Adafruit Community Code of
Conduct, please contact the maintainers of those projects for enforcement.
If you wish to use this code of conduct for your own project, consider
explicitly mentioning your moderation policy or making a copy with your
own moderation policy so as to avoid confusion.
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View file

@ -1,324 +0,0 @@
Creative Commons Attribution 4.0 International Creative Commons Corporation
("Creative Commons") is not a law firm and does not provide legal services
or legal advice. Distribution of Creative Commons public licenses does not
create a lawyer-client or other relationship. Creative Commons makes its licenses
and related information available on an "as-is" basis. Creative Commons gives
no warranties regarding its licenses, any material licensed under their terms
and conditions, or any related information. Creative Commons disclaims all
liability for damages resulting from their use to the fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions
that creators and other rights holders may use to share original works of
authorship and other material subject to copyright and certain other rights
specified in the public license below. The following considerations are for
informational purposes only, are not exhaustive, and do not form part of our
licenses.
Considerations for licensors: Our public licenses are intended for use by
those authorized to give the public permission to use material in ways otherwise
restricted by copyright and certain other rights. Our licenses are irrevocable.
Licensors should read and understand the terms and conditions of the license
they choose before applying it. Licensors should also secure all rights necessary
before applying our licenses so that the public can reuse the material as
expected. Licensors should clearly mark any material not subject to the license.
This includes other CC-licensed material, or material used under an exception
or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public licenses, a licensor
grants the public permission to use the licensed material under specified
terms and conditions. If the licensor's permission is not necessary for any
reasonfor example, because of any applicable exception or limitation to copyrightthen
that use is not regulated by the license. Our licenses grant only permissions
under copyright and certain other rights that a licensor has authority to
grant. Use of the licensed material may still be restricted for other reasons,
including because others have copyright or other rights in the material. A
licensor may make special requests, such as asking that all changes be marked
or described. Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations for the public
: wiki.creativecommons.org/Considerations_for_licensees Creative Commons Attribution
4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to
be bound by the terms and conditions of this Creative Commons Attribution
4.0 International Public License ("Public License"). To the extent this Public
License may be interpreted as a contract, You are granted the Licensed Rights
in consideration of Your acceptance of these terms and conditions, and the
Licensor grants You such rights in consideration of benefits the Licensor
receives from making the Licensed Material available under these terms and
conditions.
Section 1 Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights
that is derived from or based upon the Licensed Material and in which the
Licensed Material is translated, altered, arranged, transformed, or otherwise
modified in a manner requiring permission under the Copyright and Similar
Rights held by the Licensor. For purposes of this Public License, where the
Licensed Material is a musical work, performance, or sound recording, Adapted
Material is always produced where the Licensed Material is synched in timed
relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar
Rights in Your contributions to Adapted Material in accordance with the terms
and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights closely
related to copyright including, without limitation, performance, broadcast,
sound recording, and Sui Generis Database Rights, without regard to how the
rights are labeled or categorized. For purposes of this Public License, the
rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
d. Effective Technological Measures means those measures that, in the absence
of proper authority, may not be circumvented under laws fulfilling obligations
under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996,
and/or similar international agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or any other
exception or limitation to Copyright and Similar Rights that applies to Your
use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, or other
material to which the Licensor applied this Public License.
g. Licensed Rights means the rights granted to You subject to the terms and
conditions of this Public License, which are limited to all Copyright and
Similar Rights that apply to Your use of the Licensed Material and that the
Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights under this
Public License.
i. Share means to provide material to the public by any means or process that
requires permission under the Licensed Rights, such as reproduction, public
display, public performance, distribution, dissemination, communication, or
importation, and to make material available to the public including in ways
that members of the public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright resulting
from Directive 96/9/EC of the European Parliament and of the Council of 11
March 1996 on the legal protection of databases, as amended and/or succeeded,
as well as other essentially equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights under
this Public License. Your has a corresponding meaning.
Section 2 Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor
hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive,
irrevocable license to exercise the Licensed Rights in the Licensed Material
to:
A. reproduce and Share the Licensed Material, in whole or in part; and
B. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions
and Limitations apply to Your use, this Public License does not apply, and
You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes
You to exercise the Licensed Rights in all media and formats whether now known
or hereafter created, and to make technical modifications necessary to do
so. The Licensor waives and/or agrees not to assert any right or authority
to forbid You from making technical modifications necessary to exercise the
Licensed Rights, including technical modifications necessary to circumvent
Effective Technological Measures. For purposes of this Public License, simply
making modifications authorized by this Section 2(a)(4) never produces Adapted
Material.
5. Downstream recipients.
A. Offer from the Licensor Licensed Material. Every recipient of the Licensed
Material automatically receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this Public License.
B. No downstream restrictions. You may not offer or impose any additional
or different terms or conditions on, or apply any Effective Technological
Measures to, the Licensed Material if doing so restricts exercise of the Licensed
Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed
as permission to assert or imply that You are, or that Your use of the Licensed
Material is, connected with, or sponsored, endorsed, or granted official status
by, the Licensor or others designated to receive attribution as provided in
Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this
Public License, nor are publicity, privacy, and/or other similar personality
rights; however, to the extent possible, the Licensor waives and/or agrees
not to assert any such rights held by the Licensor to the limited extent necessary
to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties
from You for the exercise of the Licensed Rights, whether directly or through
a collecting society under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly reserves any right
to collect such royalties.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following
conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed
Material:
i. identification of the creator(s) of the Licensed Material and any others
designated to receive attribution, in any reasonable manner requested by the
Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication
of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and
include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner
based on the medium, means, and context in which You Share the Licensed Material.
For example, it may be reasonable to satisfy the conditions by providing a
URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required
by Section 3(a)(1)(A) to the extent reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's License You apply
must not prevent recipients of the Adapted Material from complying with this
Public License.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to
Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract,
reuse, reproduce, and Share all or a substantial portion of the contents of
the database;
b. if You include all or a substantial portion of the database contents in
a database in which You have Sui Generis Database Rights, then the database
in which You have Sui Generis Database Rights (but not its individual contents)
is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all or
a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace
Your obligations under this Public License where the Licensed Rights include
other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
a. Unless otherwise separately undertaken by the Licensor, to the extent possible,
the Licensor offers the Licensed Material as-is and as-available, and makes
no representations or warranties of any kind concerning the Licensed Material,
whether express, implied, statutory, or other. This includes, without limitation,
warranties of title, merchantability, fitness for a particular purpose, non-infringement,
absence of latent or other defects, accuracy, or the presence or absence of
errors, whether or not known or discoverable. Where disclaimers of warranties
are not allowed in full or in part, this disclaimer may not apply to You.
b. To the extent possible, in no event will the Licensor be liable to You
on any legal theory (including, without limitation, negligence) or otherwise
for any direct, special, indirect, incidental, consequential, punitive, exemplary,
or other losses, costs, expenses, or damages arising out of this Public License
or use of the Licensed Material, even if the Licensor has been advised of
the possibility of such losses, costs, expenses, or damages. Where a limitation
of liability is not allowed in full or in part, this limitation may not apply
to You.
c. The disclaimer of warranties and limitation of liability provided above
shall be interpreted in a manner that, to the extent possible, most closely
approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights
licensed here. However, if You fail to comply with this Public License, then
Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section
6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured
within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
c. For the avoidance of doubt, this Section 6(b) does not affect any right
the Licensor may have to seek remedies for Your violations of this Public
License.
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material
under separate terms or conditions or stop distributing the Licensed Material
at any time; however, doing so will not terminate this Public License.
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or
conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed
Material not stated herein are separate from and independent of the terms
and conditions of this Public License.
Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not
be interpreted to, reduce, limit, restrict, or impose conditions on any use
of the Licensed Material that could lawfully be made without permission under
this Public License.
b. To the extent possible, if any provision of this Public License is deemed
unenforceable, it shall be automatically reformed to the minimum extent necessary
to make it enforceable. If the provision cannot be reformed, it shall be severed
from this Public License without affecting the enforceability of the remaining
terms and conditions.
c. No term or condition of this Public License will be waived and no failure
to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation
upon, or waiver of, any privileges and immunities that apply to the Licensor
or You, including from the legal processes of any jurisdiction or authority.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative
Commons may elect to apply one of its public licenses to material it publishes
and in those instances will be considered the "Licensor." The text of the
Creative Commons public licenses is dedicated to the public domain under the
CC0 Public Domain Dedication. Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as otherwise
permitted by the Creative Commons policies published at creativecommons.org/policies,
Creative Commons does not authorize the use of the trademark "Creative Commons"
or any other trademark or logo of Creative Commons without its prior written
consent including, without limitation, in connection with any unauthorized
modifications to any of its public licenses or any other arrangements, understandings,
or agreements concerning use of licensed material. For the avoidance of doubt,
this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.

View file

@ -1,19 +0,0 @@
MIT License Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,20 +0,0 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute
this software, either in source code form or as a compiled binary, for any
purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and
to the detriment of our heirs and successors. We intend this dedication to
be an overt act of relinquishment in perpetuity of all present and future
rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information,
please refer to <https://unlicense.org/>

View file

@ -1,22 +1,6 @@
Introduction
============
.. image:: https://readthedocs.org/projects/adafruit-platformdetect/badge/?version=latest
:target: https://circuitpython.readthedocs.io/projects/platformdetect/en/latest/
:alt: Documentation Status
.. image:: https://img.shields.io/discord/327254708534116352.svg
:target: https://adafru.it/discord
:alt: Discord
.. image:: https://github.com/adafruit/Adafruit_Python_PlatformDetect/workflows/Build%20CI/badge.svg
:target: https://github.com/adafruit/Adafruit_Python_PlatformDetect/actions
:alt: Build Status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code Style: Black
This library provides best-guess platform detection for a range of single-board
computers and (potentially) other platforms. It was written primarily for use
in `Adafruit_Blinka <https://github.com/adafruit/Adafruit_Blinka>`_, but may be
@ -29,25 +13,21 @@ generally dependent on the former. Platform info is gathered from:
- Various files on Linux systems:
- /proc/cpuinfo (for processor info, Raspberry Pi hardware revisions, etc.)
- `/proc/cpuinfo` (for processor info, Raspberry Pi hardware revisions, etc.)
- /proc/device-tree/compatible (for 96Boards info)
- `/proc/device-tree/compatible` (for 96Boards info)
- Beaglebone EEPROM board IDs
- Distribution-specific files such as /etc/armbian-release.
- Distribution-specific files such as `/etc/armbian-release`.
Dependencies
=============
This driver depends on:
The API is currently unstable and may change drastically in future releases.
* Python 3.7 or higher
Installing from PyPI
=====================
Installation
============
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/Adafruit-PlatformDetect/>`_. To install for current user:
PyPI <https://pypi.org/project/adafruit-circuitpython-motorkit/>`_. To install for current user:
.. code-block:: shell
@ -68,8 +48,8 @@ To install in a virtual environment in your current project:
source .env/bin/activate
pip3 install Adafruit-PlatformDetect
Usage Example
=============
Usage
=====
.. code-block:: python
@ -83,15 +63,3 @@ Usage Example
print("BBB? ", detector.board.BEAGLEBONE_BLACK)
print("Orange Pi PC? ", detector.board.ORANGE_PI_PC)
print("generic Linux PC? ", detector.board.GENERIC_LINUX_PC)
Contributing
============
Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_Python_PlatformDetect/blob/master/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.
Documentation
=============
For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.

View file

@ -1,3 +0,0 @@
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT

View file

@ -1,76 +1,81 @@
# SPDX-FileCopyrightText: 2014-2018 Tony DiCola, Limor Fried, Brennen Bearnes
#
# SPDX-License-Identifier: MIT
# Copyright (c) 2014-2018 Adafruit Industries
# Author: Tony DiCola, Limor Fried, Brennen Bearnes
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""
Attempt to detect the current platform.
"""
import os
import re
import sys
try:
from typing import Optional
except ImportError:
pass
import platform
import re
from adafruit_platformdetect.board import Board
from adafruit_platformdetect.chip import Chip
# Needed to find libs (like libusb) installed by homebrew on Apple Silicon
if sys.platform == "darwin":
os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib/"
# Various methods here may retain state in future, so tell pylint not to worry
# that they don't use self right now:
# pylint: disable=no-self-use
class Detector:
"""Wrap various platform detection functions."""
def __init__(self) -> None:
def __init__(self):
self.board = Board(self)
self.chip = Chip(self)
def get_cpuinfo_field(self, field: str) -> Optional[str]:
def get_cpuinfo_field(self, field):
"""
Search /proc/cpuinfo for a field and return its value, if found,
otherwise None.
"""
# Match a line like 'Hardware : BCM2709':
pattern = r"^" + field + r"\s+:\s+(.*)$"
pattern = r'^' + field + r'\s+:\s+(.*)$'
with open("/proc/cpuinfo", "r", encoding="utf-8") as infile:
cpuinfo = infile.read().split("\n")
with open('/proc/cpuinfo', 'r') as infile:
cpuinfo = infile.read().split('\n')
for line in cpuinfo:
match = re.search(pattern, line, flags=re.IGNORECASE)
if match:
return match.group(1)
return None
def check_dt_compatible_value(self, value: str) -> bool:
def check_dt_compatible_value(self, value):
"""
Search /proc/device-tree/compatible for a value and return True, if found,
otherwise False.
"""
# Match a value like 'qcom,apq8016-sbc':
dt_compatible = self.get_device_compatible()
if dt_compatible and value in dt_compatible:
if value in open('/proc/device-tree/compatible').read():
return True
return False
def get_armbian_release_field(self, field: str) -> Optional[str]:
def get_armbian_release_field(self, field):
"""
Search /etc/armbian-release, if it exists, for a field and return its
value, if found, otherwise None.
"""
field_value = None
pattern = r"^" + field + r"=(.*)"
pattern = r'^' + field + r'=(.*)'
try:
with open("/etc/armbian-release", "r", encoding="utf-8") as release_file:
armbian = release_file.read().split("\n")
with open("/etc/armbian-release", 'r') as release_file:
armbian = release_file.read().split('\n')
for line in armbian:
match = re.search(pattern, line)
if match:
@ -79,56 +84,3 @@ class Detector:
pass
return field_value
def get_device_model(self) -> Optional[str]:
"""
Search /proc/device-tree/model for the device model and return its value, if found,
otherwise None.
"""
try:
with open("/proc/device-tree/model", "r", encoding="utf-8") as model_file:
return model_file.read()
except FileNotFoundError:
pass
return None
def get_device_compatible(self) -> Optional[str]:
"""
Search /proc/device-tree/compatible for the compatible chip name.
"""
try:
with open(
"/proc/device-tree/compatible", "r", encoding="utf-8"
) as model_file:
return model_file.read()
except FileNotFoundError:
pass
return None
def check_board_asset_tag_value(self) -> Optional[str]:
"""
Search /sys/devices/virtual/dmi/id for the device model and return its value, if found,
otherwise None.
"""
try:
with open(
"/sys/devices/virtual/dmi/id/board_asset_tag", "r", encoding="utf-8"
) as tag_file:
return tag_file.read().strip()
except FileNotFoundError:
pass
return None
def check_board_name_value(self) -> Optional[str]:
"""
Search /sys/devices/virtual/dmi/id for the board name and return its value, if found,
otherwise None. Debian/ubuntu based
"""
try:
with open(
"/sys/devices/virtual/dmi/id/board_name", "r", encoding="utf-8"
) as board_name_file:
return board_name_file.read().strip()
except FileNotFoundError:
pass
return None

File diff suppressed because it is too large Load diff

View file

@ -1,490 +1,103 @@
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_platformdetect.chip`
================================================================================
Attempt detection of current chip / CPU
* Author(s): Melissa LeBlanc-Williams
Implementation Notes
--------------------
**Software and Dependencies:**
* Linux and Python 3.7 or Higher
"""
import os
"""Attempt detection of current chip / CPU."""
import sys
import os
try:
from typing import Optional
except ImportError:
pass
from adafruit_platformdetect.constants import chips
__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git"
AM33XX = "AM33XX"
BCM2XXX = "BCM2XXX"
ESP8266 = "ESP8266"
SAMD21 = "SAMD21"
STM32 = "STM32"
SUN8I = "SUN8I"
S805 = "S805"
S905 = "S905"
APQ8016 = "APQ8016"
GENERIC_X86 = "GENERIC_X86"
FT232H = "FT232H"
class Chip:
"""Attempt detection of current chip / CPU."""
def __init__(self, detector) -> None:
def __init__(self, detector):
self.detector = detector
self._chip_id = None
# pylint: disable=invalid-name,too-many-branches,too-many-return-statements
@property
def id(
self,
) -> Optional[str]:
def id(self): # pylint: disable=invalid-name,too-many-branches,too-many-return-statements
"""Return a unique id for the detected chip, if any."""
# There are some times we want to trick the platform detection
# say if a raspberry pi doesn't have the right ID, or for testing
# Caching
if self._chip_id:
return self._chip_id
if getattr(os, "environ", None) is not None:
try:
return os.environ["BLINKA_FORCECHIP"]
return os.environ['BLINKA_FORCECHIP']
except KeyError: # no forced chip, continue with testing!
pass
# Special cases controlled by environment var
if os.environ.get("BLINKA_FT232H"):
from pyftdi.usbtools import UsbTools
# look for it based on PID/VID
count = len(UsbTools.find_all([(0x0403, 0x6014)]))
# Special case, if we have an environment var set, we could use FT232H
try:
if os.environ['BLINKA_FT232H']:
# we can't have ftdi1 as a dependency cause its wierd
# to install, sigh.
import ftdi1 as ftdi # pylint: disable=import-error
try:
ctx = None
ctx = ftdi.new() # Create a libftdi context.
# Enumerate FTDI devices.
count, _ = ftdi.usb_find_all(ctx, 0, 0)
if count < 0:
raise RuntimeError('ftdi_usb_find_all returned error %d : %s' %
count, ftdi.get_error_string(self._ctx))
if count == 0:
raise RuntimeError(
"BLINKA_FT232H environment variable "
+ "set, but no FT232H device found"
)
self._chip_id = chips.FT232H
return self._chip_id
if os.environ.get("BLINKA_FT2232H"):
from pyftdi.usbtools import UsbTools
# look for it based on PID/VID
count = len(UsbTools.find_all([(0x0403, 0x6010)]))
if count == 0:
raise RuntimeError(
"BLINKA_FT2232H environment variable "
+ "set, but no FT2232H device found"
)
self._chip_id = chips.FT2232H
return self._chip_id
if os.environ.get("BLINKA_FT4232H"):
from pyftdi.usbtools import UsbTools
# look for it based on PID/VID
count = len(UsbTools.find_all([(0x0403, 0x6011)]))
if count == 0:
raise RuntimeError(
"BLINKA_FT4232H environment variable "
+ "set, but no FT4232H device found"
)
self._chip_id = chips.FT4232H
return self._chip_id
if os.environ.get("BLINKA_MCP2221"):
import hid
# look for it based on PID/VID
for dev in hid.enumerate():
if dev["vendor_id"] == 0x04D8 and dev["product_id"] == 0x00DD:
self._chip_id = chips.MCP2221
return self._chip_id
raise RuntimeError(
"BLINKA_MCP2221 environment variable "
+ "set, but no MCP2221 device found"
)
if os.environ.get("BLINKA_OS_AGNOSTIC"):
# we don't need to look for this chip, it's just a flag
self._chip_id = chips.OS_AGNOSTIC
return self._chip_id
if os.environ.get("BLINKA_U2IF"):
import hid
# look for it based on PID/VID
for dev in hid.enumerate():
vendor = dev["vendor_id"]
product = dev["product_id"]
# NOTE: If any products are added here, they need added
# to _rp2040_u2if_id() in board.py as well.
# pylint: disable=too-many-boolean-expressions
if (
(
# Raspberry Pi Pico
# Radxa X4
vendor in (0xCAFE, 0xCAFF)
and product == 0x4005
)
or (
# Waveshare RP2040 One
vendor == 0x2E8A
and product == 0x103A
)
or (
# Feather RP2040
# Itsy Bitsy RP2040
# QT Py RP2040
# QT2040 Trinkey
# MacroPad RP2040
# Feather RP2040 ThinkInk
# Feather RP2040 RFM
# Feather RP2040 CAN Bus
vendor == 0x239A
and product
in (
0x00F1,
0x00FD,
0x00F7,
0x0109,
0x0107,
0x812C,
0x812E,
0x8130,
0x0105,
)
)
):
self._chip_id = chips.RP2040_U2IF
return self._chip_id
raise RuntimeError(
"BLINKA_U2IF environment variable "
+ "set, but no compatible device found"
)
if os.environ.get("BLINKA_GREATFET"):
import usb
if usb.core.find(idVendor=0x1D50, idProduct=0x60E6) is not None:
self._chip_id = chips.LPC4330
return self._chip_id
raise RuntimeError(
"BLINKA_GREATFET environment variable "
+ "set, but no GreatFET device found"
)
if os.environ.get("BLINKA_NOVA"):
self._chip_id = chips.BINHO
return self._chip_id
raise RuntimeError('BLINKA_FT232H environment variable' + \
'set, but no FT232H device found')
finally:
# Make sure to clean up list and context when done.
if ctx is not None:
ftdi.free(ctx)
return FT232H
except KeyError: # no FT232H environment var
pass
platform = sys.platform
if platform in ("linux", "linux2"):
self._chip_id = self._linux_id()
return self._chip_id
if platform == "linux":
return self._linux_id()
if platform == "esp8266":
self._chip_id = chips.ESP8266
return self._chip_id
return ESP8266
if platform == "samd21":
self._chip_id = chips.SAMD21
return self._chip_id
return SAMD21
if platform == "pyboard":
self._chip_id = chips.STM32F405
return self._chip_id
if platform == "rp2":
self._chip_id = chips.RP2040
return self._chip_id
return STM32
# nothing found!
return None
# pylint: enable=invalid-name
def _linux_id(self) -> Optional[str]:
# pylint: disable=too-many-branches,too-many-statements
# pylint: disable=too-many-return-statements
def _linux_id(self):
"""Attempt to detect the CPU on a computer running the Linux kernel."""
if self.detector.check_dt_compatible_value("beagle,am67a-beagley-ai"):
return chips.AM67A
if self.detector.check_dt_compatible_value("ti,am625"):
return chips.AM625X
if self.detector.check_dt_compatible_value("ti,am654"):
return chips.AM65XX
if self.detector.check_dt_compatible_value("ti,am652"):
return chips.AM65XX
if self.detector.check_dt_compatible_value("sun4i-a10"):
return chips.A10
if self.detector.check_dt_compatible_value("sun7i-a20"):
return chips.A20
if self.detector.check_dt_compatible_value("amlogic,g12a"):
return chips.S905Y2
if self.detector.check_dt_compatible_value("amlogic, g12a"):
return chips.S905X3
if self.detector.check_dt_compatible_value("sun8i-h3"):
return chips.H3
if self.detector.check_dt_compatible_value("qcom,apq8016"):
return chips.APQ8016
if self.detector.check_dt_compatible_value("fu500"):
return chips.HFU540
if self.detector.check_dt_compatible_value("sun20iw1p1"):
return chips.C906
# Older Builds
if self.detector.check_dt_compatible_value("sifive"):
return chips.JH71X0
# Newer Builds
if self.detector.check_dt_compatible_value("jh7100"):
return chips.JH71X0
if self.detector.check_dt_compatible_value("jh7110"):
return chips.JH7110
if self.detector.check_dt_compatible_value("sun8i-a33"):
return chips.A33
if self.detector.check_dt_compatible_value("rockchip,rk3308"):
return chips.RK3308
if self.detector.check_dt_compatible_value("radxa,rock-4c-plus"):
return chips.RK3399_T
if self.detector.check_dt_compatible_value("rockchip,rk3399pro"):
return chips.RK3399PRO
if self.detector.check_dt_compatible_value("rockchip,rk3399"):
return chips.RK3399
if self.detector.check_dt_compatible_value("rockchip,rk3288"):
return chips.RK3288
if self.detector.check_dt_compatible_value("rockchip,rk3328"):
return chips.RK3328
if self.detector.check_dt_compatible_value("rockchip,rk3566"):
return chips.RK3566
if self.detector.check_dt_compatible_value("rockchip,rk3568"):
return chips.RK3568
if self.detector.check_dt_compatible_value("rockchip,rk3588s"):
return chips.RK3588S
if self.detector.check_dt_compatible_value("rockchip,rk3588"):
return chips.RK3588
if self.detector.check_dt_compatible_value("rockchip,rv1106"):
return chips.RV1106
if self.detector.check_dt_compatible_value("rockchip,rv1103"):
return chips.RV1103
if self.detector.check_dt_compatible_value("amlogic,a311d"):
return chips.A311D
if self.detector.check_dt_compatible_value("st,stm32mp157"):
return chips.STM32MP157
if self.detector.check_dt_compatible_value("st,stm32mp153"):
return chips.STM32MP157DAA1
if self.detector.check_dt_compatible_value("sun50i-a64"):
return chips.A64
if self.detector.check_dt_compatible_value("sun50i-h5"):
return chips.H5
if self.detector.check_dt_compatible_value("sun50i-h618"):
return chips.H618
if self.detector.check_dt_compatible_value("sun50i-h616"):
return chips.H616
if self.detector.check_dt_compatible_value("sun50iw9"):
return chips.H616
if self.detector.check_dt_compatible_value("sun50i-h6"):
return chips.H6
if self.detector.check_dt_compatible_value("sun55iw3"):
return chips.T527
if self.detector.check_dt_compatible_value("spacemit,k1-x"):
return chips.K1
if self.detector.check_dt_compatible_value("renesas,r9a09g056"):
return chips.RZV2N
if self.detector.check_dt_compatible_value("renesas,r9a09g057"):
return chips.RZV2H
if self.detector.check_dt_compatible_value("mediatek,mt8167"):
return chips.MT8167
if self.detector.check_dt_compatible_value("imx6ull"):
return chips.IMX6ULL
if self.detector.check_dt_compatible_value("ti,j721e"):
return chips.TDA4VM
if self.detector.check_dt_compatible_value("sun20i-d1"):
return chips.D1_RISCV
if self.detector.check_dt_compatible_value("imx8mp"):
return chips.IMX8MP
if self.detector.check_dt_compatible_value("libretech,aml-s905x-cc"):
return chips.S905X
if self.detector.check_dt_compatible_value("light-lpi4a"):
return chips.TH1520
if self.detector.check_dt_compatible_value("hobot,x3"):
return chips.SUNRISE_X3
if self.detector.check_dt_compatible_value("particle,tachyon"):
return chips.QCM6490
return APQ8016
linux_id = None
hardware = self.detector.get_cpuinfo_field("Hardware")
if hardware is None:
vendor_id = self.detector.get_cpuinfo_field("vendor_id")
if vendor_id == "AuthenticAMD":
model_name = self.detector.get_cpuinfo_field("model name").upper()
if "RYZEN EMBEDDED V1202B" in model_name:
linux_id = chips.RYZEN_V1202B
if "RYZEN EMBEDDED V1605B" in model_name:
linux_id = chips.RYZEN_V1605B
else:
linux_id = chips.GENERIC_X86
## print("linux_id = ", linux_id)
elif vendor_id == "GenuineIntel":
model_name = self.detector.get_cpuinfo_field("model name").upper()
## print('model_name =', model_name)
if "N3710" in model_name:
linux_id = chips.PENTIUM_N3710
if "N5105" in model_name:
linux_id = chips.CELERON_N5105
elif "X5-Z8350" in model_name:
linux_id = chips.ATOM_X5_Z8350
elif "J4105" in model_name:
linux_id = chips.ATOM_J4105
else:
linux_id = chips.GENERIC_X86
## print("linux_id = ", linux_id)
compatible = self.detector.get_device_compatible()
if compatible and "tegra" in compatible:
compats = compatible.split("\x00")
if "nvidia,tegra210" in compats:
linux_id = chips.T210
elif "nvidia,tegra186" in compats:
linux_id = chips.T186
elif "nvidia,tegra194" in compats:
linux_id = chips.T194
elif "nvidia,tegra234" in compats:
linux_id = chips.T234
if compatible and "imx8m" in compatible:
linux_id = chips.IMX8MX
if compatible and "odroid-c2" in compatible:
linux_id = chips.S905
if compatible and "amlogic" in compatible:
compatible_list = (
compatible.replace("\x00", ",").replace(" ", "").split(",")
)
if "g12a" in compatible_list:
# 'sm1' is correct for S905X3, but some kernels use 'g12a'
return chips.S905X3
if "g12b" in compatible_list:
return chips.S922X
if "sm1" in compatible_list:
return chips.S905X3
if "vim3amlogic" in compatible_list:
return chips.A311D
if compatible and "sun50i-a64" in compatible:
linux_id = chips.A64
if compatible and "sun50i-h6" in compatible:
linux_id = chips.H6
if compatible and "sun50i-h5" in compatible:
linux_id = chips.H5
if compatible and "odroid-xu4" in compatible:
linux_id = chips.EXYNOS5422
if compatible and "cvitek,cv180x" in compatible:
linux_id = chips.CV1800B
cpu_model = self.detector.get_cpuinfo_field("cpu model")
if cpu_model is not None:
if "MIPS 24Kc" in cpu_model:
linux_id = chips.MIPS24KC
elif "MIPS 24KEc" in cpu_model:
linux_id = chips.MIPS24KEC
# we still haven't identified the hardware, so
# convert it to a list and let the remaining
# conditions attempt.
if not linux_id:
hardware = [
entry.replace("\x00", "") for entry in compatible.split(",")
]
if not linux_id:
if "AM33XX" in hardware:
linux_id = chips.AM33XX
elif "DRA74X" in hardware:
linux_id = chips.DRA74X
elif "sun4i" in hardware:
linux_id = chips.A10
elif "sun7i" in hardware:
linux_id = chips.A20
if vendor_id in ("GenuineIntel", "AuthenticAMD"):
linux_id = GENERIC_X86
elif hardware in ("BCM2708", "BCM2708", "BCM2835"):
linux_id = BCM2XXX
elif "AM33XX" in hardware:
linux_id = AM33XX
elif "sun8i" in hardware:
linux_id = chips.SUN8I
linux_id = SUN8I
elif "ODROIDC" in hardware:
linux_id = chips.S805
linux_id = S805
elif "ODROID-C2" in hardware:
linux_id = chips.S905
elif "ODROID-N2" in hardware:
linux_id = chips.S922X
elif "ODROID-C4" in hardware:
linux_id = chips.S905X3
elif "ODROID-XU4" in hardware:
linux_id = chips.EXYNOS5422
elif "KHADAS-VIM3" in hardware:
linux_id = chips.A311D
elif "SAMA5" in hardware:
linux_id = chips.SAMA5
elif "Pinebook" in hardware:
linux_id = chips.A64
elif "ASUS_TINKER_BOARD" in hardware:
linux_id = chips.RK3288
elif "Xilinx Zynq" in hardware:
compatible = self.detector.get_device_compatible()
if compatible and "xlnx,zynq-7000" in compatible:
linux_id = chips.ZYNQ7000
else:
if isinstance(hardware, str):
if hardware.upper() in chips.BCM_RANGE:
linux_id = chips.BCM2XXX
elif isinstance(hardware, list):
if {model.upper() for model in hardware} & chips.BCM_RANGE:
linux_id = chips.BCM2XXX
linux_id = S905
return linux_id
def __getattr__(self, attr: str) -> bool:
def __getattr__(self, attr):
"""
Detect whether the given attribute is the currently-detected chip. See
list of constants at the top of this module for available options.
"""
if attr == "id":
raise AttributeError() # Avoid infinite recursion
if self.id == attr:
return True
return False

View file

@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Common constants used all over the module."""

View file

@ -1,707 +0,0 @@
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Definition of boards and/or ids"""
# Allow for aligned constant definitions:
VISIONFIVE2 = "VISIONFIVE2"
BEAGLE_PLAY = "BEAGLE_PLAY"
BEAGLEBONE_AI64 = "BEAGLEBONE_AI64"
BEAGLEBONE = "BEAGLEBONE"
BEAGLEBONE_BLACK = "BEAGLEBONE_BLACK"
BEAGLEBONE_BLUE = "BEAGLEBONE_BLUE"
BEAGLEBONE_BLACK_WIRELESS = "BEAGLEBONE_BLACK_WIRELESS"
BEAGLEBONE_POCKETBEAGLE = "BEAGLEBONE_POCKETBEAGLE"
BEAGLEBONE_GREEN = "BEAGLEBONE_GREEN"
BEAGLEBONE_GREEN_WIRELESS = "BEAGLEBONE_GREEN_WIRELESS"
BEAGLEBONE_GREEN_GATEWAY = "BEAGLEBONE_GREEN_GATEWAY"
BEAGLEBONE_BLACK_INDUSTRIAL = "BEAGLEBONE_BLACK_INDUSTRIAL"
BEAGLEBONE_ENHANCED = "BEAGLEBONE_ENHANCED"
BEAGLEBONE_USOMIQ = "BEAGLEBONE_USOMIQ"
BEAGLEBONE_AIR = "BEAGLEBONE_AIR"
BEAGLEBONE_AI = "BEAGLEBONE_AI"
BEAGLEBONE_POCKETBONE = "BEAGLEBONE_POCKETBONE"
BEAGLEV_STARLIGHT = "BEAGLEV_STARLIGHT"
BEAGLEY_AI = "BEAGLEY_AI"
BEAGLELOGIC_STANDALONE = "BEAGLELOGIC_STANDALONE"
OSD3358_DEV_BOARD = "OSD3358_DEV_BOARD"
OSD3358_SM_RED = "OSD3358_SM_RED"
OLIMEX_LIME2 = "OLIMEX_LIME2"
FEATHER_HUZZAH = "FEATHER_HUZZAH"
FEATHER_M0_EXPRESS = "FEATHER_M0_EXPRESS"
GENERIC_LINUX_PC = "GENERIC_LINUX_PC"
PYBOARD = "PYBOARD"
NODEMCU = "NODEMCU"
RASPBERRY_PI_PICO = "RASPBERRY_PI_PICO"
GIANT_BOARD = "GIANT_BOARD"
# ASUS Tinker Boards
ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD"
ASUS_TINKER_BOARD_2 = "ASUS_TINKER_BOARD_2"
ASUS_TINKER_EDGE_R = "ASUS_TINKER_EDGE_R"
# Walnut Pi boards
WALNUT_PI_1B = "WALNUT_PI_1B"
WALNUT_PI_1B_EMMC = "WALNUT_PI_1B_EMMC"
# Clockwork Pi boards
CLOCKWORK_CPI3 = "CLOCKWORK_CPI3"
# Orange Pi boards
ORANGE_PI_PC = "ORANGE_PI_PC"
ORANGE_PI_R1 = "ORANGE_PI_R1"
ORANGE_PI_ZERO = "ORANGE_PI_ZERO"
ORANGE_PI_ONE = "ORANGE_PI_ONE"
ORANGE_PI_LITE = "ORANGE_PI_LITE"
ORANGE_PI_PC_PLUS = "ORANGE_PI_PC_PLUS"
ORANGE_PI_PLUS_2E = "ORANGE_PI_PLUS_2E"
ORANGE_PI_2 = "ORANGE_PI_2"
ORANGE_PI_PC2 = "ORANGE_PI_PC2"
ORANGE_PI_ZERO_PLUS_2H5 = "ORANGE_PI_ZERO_PLUS_2H5"
ORANGE_PI_ZERO_PLUS = "ORANGE_PI_ZERO_PLUS"
ORANGE_PI_ZERO_2 = "ORANGE_PI_ZERO_2"
ORANGE_PI_ZERO_3 = "ORANGE_PI_ZERO_3"
ORANGE_PI_3 = "ORANGE_PI_3"
ORANGE_PI_3B = "ORANGE_PI_3B"
ORANGE_PI_3_LTS = "ORANGE_PI_3_LTS"
ORANGE_PI_4 = "ORANGE_PI_4"
ORANGE_PI_4_LTS = "ORANGE_PI_4_LTS"
ORANGE_PI_5 = "ORANGE_PI_5"
ORANGE_PI_5_MAX = "ORANGE_PI_5_MAX"
ORANGE_PI_5_PLUS = "ORANGE_PI_5_PLUS"
ORANGE_PI_5_PRO = "ORANGE_PI_5_PRO"
# Nano Pi boards
NANOPI_NEO_AIR = "NANOPI_NEO_AIR"
NANOPI_DUO2 = "NANOPI_DUO2"
NANOPI_NEO = "NANOPI_NEO"
NANOPI_NEO_2 = "NANOPI_NEO_2"
# Banana Pi boards
BANANA_PI_M2_ZERO = "BANANA_PI_M2_ZERO"
BANANA_PI_M2_PLUS = "BANANA_PI_M2_PLUS"
BANANA_PI_M2_BERRY = "BANANA_PI_M2_BERRY"
BANANA_PI_M4_BERRY = "BANANA_PI_M4_BERRY"
BANANA_PI_M4_ZERO = "BANANA_PI_M4_ZERO"
BANANA_PI_M5 = "BANANA_PI_M5"
BANANA_PI_F3 = "BANANA_PI_F3"
BANANA_PI_F5 = "BANANA_PI_F5"
BANANA_PI_AI2N = "BANANA_PI_AI2N"
BANANA_PI_AI2H = "BANANA_PI_AI2H"
# LeMaker boards
LEMAKER_BANANA_PRO = "LEMAKER_BANANA_PRO"
# NVIDIA Jetson boards
JETSON_TX1 = "JETSON_TX1"
JETSON_TX2 = "JETSON_TX2"
JETSON_TX2_NX = "JETSON_TX2_NX"
CLARA_AGX_XAVIER = "CLARA_AGX_XAVIER"
JETSON_XAVIER = "JETSON_XAVIER"
JETSON_AGX_ORIN = "JETSON_ORIN"
JETSON_NANO = "JETSON_NANO"
JETSON_NX = "JETSON_NX"
JETSON_ORIN_NANO = "JETSON_ORIN_NANO"
JETSON_ORIN_NX = "JETSON_ORIN_NX"
JETSON_THOR = "JETSON_THOR"
# Texas Instruments SK boards
TI_J721E_SK = "TI_J721E_SK"
# Google Coral dev board
CORAL_EDGE_TPU_DEV = "CORAL_EDGE_TPU_DEV"
CORAL_EDGE_TPU_DEV_MINI = "CORAL_EDGE_TPU_DEV_MINI"
# Xilinx PYNQ FPGA dev boards
PYNQ_Z1 = "PYNQ_Z1"
PYNQ_Z2 = "PYNQ_Z2"
# STM32 MPU boards
STM32MP157C_DK2 = "STM32MP157C_DK2"
OSD32MP1_BRK = "OSD32MP1_BRK"
OSD32MP1_RED = "OSD32MP1_RED"
STMP157_OLINUXINO_LIME2 = "STMP157_OLINUXINO_LIME2"
# Embedfire LubanCat board
LUBANCAT_IMX6ULL = "LUBANCAT_IMX6ULL"
LUBANCAT_STM32MP157 = "LUBANCAT_STM32MP157"
LUBANCAT_ZERO = "LUBANCAT_ZERO"
LUBANCAT1 = "LUBANCAT1"
LUBANCAT2 = "LUBANCAT2"
LUBANCAT4 = "LUBANCAT4"
LUBANCAT5 = "LUBANCAT5"
# Various Raspberry Pi models
RASPBERRY_PI_B_REV1 = "RASPBERRY_PI_B_REV1"
RASPBERRY_PI_B_REV2 = "RASPBERRY_PI_B_REV2"
RASPBERRY_PI_B_PLUS = "RASPBERRY_PI_B_PLUS"
RASPBERRY_PI_A = "RASPBERRY_PI_A"
RASPBERRY_PI_A_PLUS = "RASPBERRY_PI_A_PLUS"
RASPBERRY_PI_CM1 = "RASPBERRY_PI_CM1"
RASPBERRY_PI_ZERO = "RASPBERRY_PI_ZERO"
RASPBERRY_PI_ZERO_W = "RASPBERRY_PI_ZERO_W"
RASPBERRY_PI_ZERO_2_W = "RASPBERRY_PI_ZERO_2_W"
RASPBERRY_PI_2B = "RASPBERRY_PI_2B"
RASPBERRY_PI_3B = "RASPBERRY_PI_3B"
RASPBERRY_PI_3B_PLUS = "RASPBERRY_PI_3B_PLUS"
RASPBERRY_PI_CM3 = "RASPBERRY_PI_CM3"
RASPBERRY_PI_3A_PLUS = "RASPBERRY_PI_3A_PLUS"
RASPBERRY_PI_CM3_PLUS = "RASPBERRY_PI_CM3_PLUS"
RASPBERRY_PI_4B = "RASPBERRY_PI_4B"
RASPBERRY_PI_AVNET_IIOT_GW = "RASPBERY_PI_AVNET_IIOT_GW"
RASPBERRY_PI_400 = "RASPBERRY_PI_400"
RASPBERRY_PI_CM4 = "RASPBERRY_PI_CM4"
RASPBERRY_PI_CM4S = "RASPBERRY_PI_CM4S"
RASPBERRY_PI_5 = "RASPBERRY_PI_5"
RASPBERRY_PI_CM5 = "RASPBERRY_PI_CM5"
RASPBERRY_PI_500 = "RASPBERRY_PI_500"
RASPBERRY_PI_CM5_LITE = "RASPBERRY_PI_CM5_LITE"
ODROID_C1 = "ODROID_C1"
ODROID_C1_PLUS = "ODROID_C1_PLUS"
ODROID_C2 = "ODROID_C2"
ODROID_C4 = "ODROID_C4"
ODROID_H3 = "ODROID_H3"
ODROID_N2 = "ODROID_N2"
ODROID_XU4 = "ODROID_XU4"
ODROID_M1 = "ODROID_M1"
ODROID_M1S = "ODROID_M1S"
FTDI_FT232H = "FTDI_FT232H"
FTDI_FT2232H = "FTDI_FT2232H"
FTDI_FT4232H = "FTDI_FT4232H"
DRAGONBOARD_410C = "DRAGONBOARD_410C"
SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"
ALLWINER_D1 = "ALLWINER_D1"
LICHEE_RV = "LICHEE_RV"
LICHEEPI_4A = "LICHEEPI_4A"
MICROCHIP_MCP2221 = "MICROCHIP_MCP2221"
# Linkspirte Pcduino based boards
PCDUINO2 = "PCDUINO2"
PCDUINO3 = "PCDUINO3"
# Boards with u2if firmware
# https://github.com/execuc/u2if
PICO_U2IF = "PICO_U2IF"
FEATHER_U2IF = "FEATHER_U2IF"
FEATHER_CAN_U2IF = "FEATHER_CAN_U2IF"
FEATHER_EPD_U2IF = "FEATHER_EPD_U2IF"
FEATHER_RFM_U2IF = "FEATHER_RFM_U2IF"
ITSYBITSY_U2IF = "ITSYBITSY_U2IF"
MACROPAD_U2IF = "MACROPAD_U2IF"
QTPY_U2IF = "QTPY_U2IF"
QT2040_TRINKEY_U2IF = "QT2040_TRINKEY_U2IF"
KB2040_U2IF = "KB2040_U2IF"
RP2040_ONE_U2IF = "RP2040_ONE_U2IF"
RADXA_X4_U2IF = "RADXA_X4_U2IF"
BINHO_NOVA = "BINHO_NOVA"
ONION_OMEGA = "ONION_OMEGA"
ONION_OMEGA2 = "ONION_OMEGA2"
PINE64 = "PINE64"
PINEH64 = "PINEH64"
PINEBOOK = "PINEBOOK"
PINEPHONE = "PINEPHONE"
SOPINE = "SOPINE"
QUARTZ64_A = "QUARTZ64_A"
RADXA_ZERO = "RADXA_ZERO"
RADXA_ZERO3 = "RADXA_ZERO3"
RADXA_CM3 = "RADXA_CM3"
ROCK_PI_3A = "ROCK_PI_3A"
ROCK_3B = "ROCK_3B"
ROCK_PI_3C = "ROCK_PI_3C"
ROCK_PI_S = "ROCK_PI_S"
ROCK_PI_4 = "ROCK_PI_4"
ROCK_PI_4_C_PLUS = "ROCK_PI_4C+"
ROCK_PI_4_SE = "ROCK_PI_4_SE"
ROCK_PI_X = "ROCK_PI_X"
ROCK_PI_E = "ROCK_PI_E"
ROCK_PI_5 = "ROCK_PI_5"
ROCK_PI_5C = "ROCK_PI_5C"
# Vicharak Boards
VAAMAN = "VAAMAN"
AXON = "AXON"
GREATFET_ONE = "GREATFET_ONE"
# SeeedStudio boards
ODYSSEY_X86J41X5 = "ODYSSEY_X86J41X5"
# Udoo boards
UDOO_BOLT_V3 = "UDOO_BOLT_V3"
UDOO_BOLT_V8 = "UDOO_BOLT_V8"
UDOO_X86 = "UDOO_X86"
# MaaXBoard
MAAXBOARD = "MAAXBOARD"
MAAXBOARD_MINI = "MAAXBOARD_MINI"
# Shenzhen MilkV Technology boards ids
MILKV_DUO = "MILKV_DUO"
# Khadas VIM3
KHADAS_VIM3 = "KHADAS_VIM3"
_KHADAS_40_PIN_IDS = (KHADAS_VIM3,)
# Vivid Unit
VIVID_UNIT = "VIVID_UNIT"
_VIVID_UNIT_IDS = (VIVID_UNIT,)
# Luckfox Pico boards
LUCKFOX_PICO = "LUCKFOX_PICO"
LUCKFOX_PICO_MAX = "LUCKFOX_PICO_MAX"
LUCKFOX_PICO_MINI = "LUCKFOX_PICO_MINI"
LUCKFOX_PICO_PLUS = "LUCKFOX_PICO_PLUS"
# Ameridroid boards
INDIEDROID_NOVA = "INDIEDROID_NOVA"
# Horizon
RDK_X3 = "RDK_X3"
# Particle
PARTICLE_TACHYON = "PARTICLE_TACHYON"
# StarFive boards
_STARFIVE_BOARD_IDS = (VISIONFIVE2,)
# Asus Tinkerboard
_ASUS_TINKER_BOARD_IDS = (
ASUS_TINKER_BOARD,
ASUS_TINKER_BOARD_2,
ASUS_TINKER_EDGE_R,
)
# WalnutPi
_WALNUT_PI_IDS = (
WALNUT_PI_1B,
WALNUT_PI_1B_EMMC,
)
# STM32MP1
_STM32MP1_IDS = (
STM32MP157C_DK2,
LUBANCAT_STM32MP157,
OSD32MP1_BRK,
OSD32MP1_RED,
STMP157_OLINUXINO_LIME2,
)
# OrangePI
_ORANGE_PI_IDS = (
ORANGE_PI_PC,
ORANGE_PI_R1,
ORANGE_PI_ZERO,
ORANGE_PI_ONE,
ORANGE_PI_LITE,
ORANGE_PI_PC_PLUS,
ORANGE_PI_PLUS_2E,
ORANGE_PI_2,
ORANGE_PI_PC2,
ORANGE_PI_ZERO_PLUS_2H5,
ORANGE_PI_ZERO_PLUS,
ORANGE_PI_ZERO_2,
ORANGE_PI_3,
ORANGE_PI_3B,
ORANGE_PI_3_LTS,
ORANGE_PI_4,
ORANGE_PI_4_LTS,
ORANGE_PI_5,
ORANGE_PI_5_PLUS,
ORANGE_PI_5_PRO,
)
# NanoPi
_NANOPI_IDS = (
NANOPI_NEO_AIR,
NANOPI_DUO2,
NANOPI_NEO,
NANOPI_NEO_2,
)
# BananaPI
_BANANA_PI_IDS = (
BANANA_PI_M2_ZERO,
BANANA_PI_M2_PLUS,
BANANA_PI_M2_BERRY,
BANANA_PI_M4_BERRY,
BANANA_PI_M4_ZERO,
BANANA_PI_M5,
BANANA_PI_F3,
BANANA_PI_F5,
BANANA_PI_AI2N,
BANANA_PI_AI2H,
)
# LeMaker
_LEMAKER_IDS = (LEMAKER_BANANA_PRO,)
# LubanCat
_LUBANCAT_IDS = (
LUBANCAT_IMX6ULL,
LUBANCAT_STM32MP157,
LUBANCAT_ZERO,
LUBANCAT1,
LUBANCAT2,
LUBANCAT4,
LUBANCAT5,
)
# Coral boards
_CORAL_IDS = (CORAL_EDGE_TPU_DEV, CORAL_EDGE_TPU_DEV_MINI)
_PYNQ_IDS = (PYNQ_Z1, PYNQ_Z2)
_JETSON_IDS = (
(JETSON_TX1, ("nvidia,p2371-2180", "nvidia,jetson-cv")),
(
JETSON_TX2,
(
"nvidia,p2771-0000",
"nvidia,p2771-0888",
"nvidia,p3489-0000",
"nvidia,lightning",
"nvidia,quill",
"nvidia,storm",
),
),
(JETSON_TX2_NX, ("nvidia,p3509-0000+p3636-0001",)),
(CLARA_AGX_XAVIER, ("nvidia,e3900-0000+p2888-0004",)),
(
JETSON_XAVIER,
(
"nvidia,p2972-0000",
"nvidia,p2972-0006",
"nvidia,jetson-xavier",
"nvidia,jetson-xavier-industrial",
"nvidia,galen-industrial",
),
),
(JETSON_NANO, ("nvidia,p3450-0000", "nvidia,p3450-0002", "nvidia,jetson-nano")),
(
JETSON_NX,
(
"nvidia,p3509-0000+p3668-0000",
"nvidia,p3509-0000+p3668-0001",
"nvidia,p3509-0000-a00+p3668-0000-a01",
"nvidia,p3509-0000-a00+p3668-0001-a01",
"nvidia,p3449-0000+p3668-0000",
"nvidia,p3449-0000+p3668-0001",
"nvidia,p3449-0000+p3668-0003",
),
),
(
JETSON_AGX_ORIN,
(
"nvidia,p3737-0000+p3701-0000",
"nvidia,p3737-0000+p3701-0004",
"nvidia,p3737-0000+p3701-0008",
"nvidia,p3737-0000+p3701-0005",
"nvidia,p3737-0000+p3701-0001",
),
),
(
JETSON_ORIN_NX,
(
"nvidia,p3509-0000+p3767-0000",
"nvidia,p3768-0000+p3767-0000",
"nvidia,p3509-0000+p3767-0001",
"nvidia,p3768-0000+p3767-0001",
),
),
(
JETSON_ORIN_NANO,
(
"nvidia,p3509-0000+p3767-0003",
"nvidia,p3768-0000+p3767-0003",
"nvidia,p3509-0000+p3767-0004",
"nvidia,p3768-0000+p3767-0004",
"nvidia,p3509-0000+p3767-0005",
"nvidia,p3768-0000+p3767-0005",
"nvidia,p3768-0000+p3767-0005-super",
),
),
(
JETSON_THOR,
(
"nvidia,p3971-0050+p3834-0005",
"nvidia,p3971-0080+p3834-0008",
"nvidia,p3971-0089+p3834-0008",
),
),
)
_TI_SK_BOARD_IDS = ((TI_J721E_SK, ("ti,j721e-sk", "ti,j721e")),)
# Raspberry Pi boards
_RASPBERRY_PI_40_PIN_IDS = (
RASPBERRY_PI_B_PLUS,
RASPBERRY_PI_A_PLUS,
RASPBERRY_PI_ZERO,
RASPBERRY_PI_ZERO_W,
RASPBERRY_PI_ZERO_2_W,
RASPBERRY_PI_2B,
RASPBERRY_PI_3B,
RASPBERRY_PI_3B_PLUS,
RASPBERRY_PI_3A_PLUS,
RASPBERRY_PI_4B,
RASPBERRY_PI_AVNET_IIOT_GW,
RASPBERRY_PI_400,
RASPBERRY_PI_5,
RASPBERRY_PI_500,
)
_RASPBERRY_PI_CM_IDS = (
RASPBERRY_PI_CM1,
RASPBERRY_PI_CM3,
RASPBERRY_PI_CM3_PLUS,
RASPBERRY_PI_CM4,
RASPBERRY_PI_CM4S,
RASPBERRY_PI_CM5,
RASPBERRY_PI_CM5_LITE,
)
# Pi 4 boards have additional peripherals
_RASPBERRY_PI_4_IDS = (
RASPBERRY_PI_4B,
RASPBERRY_PI_CM4,
RASPBERRY_PI_CM4S,
RASPBERRY_PI_400,
)
# Pi 5 boards work differently
_RASPBERRY_PI_5_IDS = (
RASPBERRY_PI_5,
RASPBERRY_PI_CM5,
RASPBERRY_PI_500,
RASPBERRY_PI_CM5_LITE,
)
_PI_MODELS = {
0x00: RASPBERRY_PI_A,
0x01: {
1.0: RASPBERRY_PI_B_REV1,
2.0: RASPBERRY_PI_B_REV2,
},
0x02: RASPBERRY_PI_A_PLUS,
0x03: RASPBERRY_PI_B_PLUS,
0x04: RASPBERRY_PI_2B,
0x06: RASPBERRY_PI_CM1,
0x08: RASPBERRY_PI_3B,
0x09: RASPBERRY_PI_ZERO,
0x0A: RASPBERRY_PI_CM3,
0x0B: RASPBERRY_PI_AVNET_IIOT_GW,
0x0C: RASPBERRY_PI_ZERO_W,
0x0D: RASPBERRY_PI_3B_PLUS,
0x0E: RASPBERRY_PI_3A_PLUS,
0x10: RASPBERRY_PI_CM3_PLUS,
0x11: RASPBERRY_PI_4B,
0x12: RASPBERRY_PI_ZERO_2_W,
0x13: RASPBERRY_PI_400,
0x14: RASPBERRY_PI_CM4,
0x15: RASPBERRY_PI_CM4S,
0x17: RASPBERRY_PI_5,
0x18: RASPBERRY_PI_CM5,
0x19: RASPBERRY_PI_500,
0x1A: RASPBERRY_PI_CM5_LITE,
}
# ODROID boards
_ODROID_40_PIN_IDS = (
ODROID_C1,
ODROID_C1_PLUS,
ODROID_C2,
ODROID_C4,
ODROID_N2,
ODROID_XU4,
ODROID_M1,
ODROID_M1S,
)
_ODROID_MINI_PC_IDS = (ODROID_H3,)
_BEAGLEBONE_IDS = (
BEAGLEY_AI,
BEAGLE_PLAY,
BEAGLEBONE_AI64,
BEAGLEBONE,
BEAGLEBONE_BLACK,
BEAGLEBONE_BLUE,
BEAGLEBONE_BLACK_WIRELESS,
BEAGLEBONE_POCKETBEAGLE,
BEAGLEBONE_GREEN,
BEAGLEBONE_GREEN_WIRELESS,
BEAGLEBONE_GREEN_GATEWAY,
BEAGLEBONE_BLACK_INDUSTRIAL,
BEAGLEBONE_ENHANCED,
BEAGLEBONE_USOMIQ,
BEAGLEBONE_AIR,
BEAGLEBONE_AI,
BEAGLEBONE_POCKETBONE,
BEAGLELOGIC_STANDALONE,
BEAGLEV_STARLIGHT,
OSD3358_DEV_BOARD,
OSD3358_SM_RED,
)
_LINARO_96BOARDS_IDS = (DRAGONBOARD_410C,)
_SIFIVE_IDS = (SIFIVE_UNLEASHED,)
_OLIMEX_IDS = (OLIMEX_LIME2,)
# BeagleBone eeprom board ids from:
# https://github.com/beagleboard/image-builder
# Thanks to zmatt on freenode #beagle for pointers.
_BEAGLEBONE_BOARD_IDS = {
BEAGLE_PLAY: ("A0", "7.BEAGLE"),
BEAGLEBONE_AI64: ("B0", "7.BBONEA"),
# Original bone/white:
BEAGLEBONE: (
("A3", "A335BONE00A3"),
("A4", "A335BONE00A4"),
("A5", "A335BONE00A5"),
("A6", "A335BONE00A6"),
("A6A", "A335BONE0A6A"),
("A6B", "A335BONE0A6B"),
("B", "A335BONE000B"),
),
BEAGLEBONE_BLACK: (
("A5", "A335BNLT00A5"),
("A5A", "A335BNLT0A5A"),
("A5B", "A335BNLT0A5B"),
("A5C", "A335BNLT0A5C"),
("A6", "A335BNLT00A6"),
("A6A", "A335BNLT0A6A"),
("B", "A335BNLT000B"),
("C", "A335BNLT000C"),
("C", "A335BNLT00C0"),
),
BEAGLEBONE_BLUE: (("A2", "A335BNLTBLA2"),),
BEAGLEBONE_BLACK_WIRELESS: (("A5", "A335BNLTBWA5"),),
BEAGLEBONE_POCKETBEAGLE: (("A2", "A335PBGL00A2"),),
BEAGLEBONE_GREEN: (("1A", "A335BNLT...."), ("UNKNOWN", "A335BNLTBBG1")),
BEAGLEBONE_GREEN_WIRELESS: (("W1A", "A335BNLTGW1A"),),
BEAGLEBONE_GREEN_GATEWAY: (("GA1", "A335BNLTGG1A"),),
BEAGLEBONE_BLACK_INDUSTRIAL: (
("A0", "A335BNLTAIA0"), # Arrow
("A0", "A335BNLTEIA0"), # Element14
),
BEAGLEBONE_ENHANCED: (("A", "A335BNLTSE0A"),),
BEAGLEBONE_USOMIQ: (("6", "A335BNLTME06"),),
BEAGLEBONE_AIR: (("A0", "A335BNLTNAD0"),),
BEAGLEBONE_POCKETBONE: (("0", "A335BNLTBP00"),),
OSD3358_DEV_BOARD: (("0.1", "A335BNLTGH01"),),
OSD3358_SM_RED: (("0", "A335BNLTOS00"),),
BEAGLELOGIC_STANDALONE: (("A", "A335BLGC000A"),),
}
# Onion omega boards
_ONION_OMEGA_BOARD_IDS = (ONION_OMEGA, ONION_OMEGA2)
# Pine64 boards and devices
_PINE64_DEV_IDS = (PINE64, PINEH64, PINEBOOK, PINEPHONE, SOPINE, QUARTZ64_A)
# Pcduino boards
_PCDUINO_DEV_IDS = (PCDUINO2, PCDUINO3)
# RockPi boards and devices
_ROCK_PI_IDS = (
ROCK_PI_S,
ROCK_PI_4,
ROCK_PI_4_C_PLUS,
ROCK_PI_4_SE,
ROCK_PI_X,
ROCK_PI_E,
RADXA_ZERO,
RADXA_ZERO3,
ROCK_PI_5,
ROCK_PI_5C,
RADXA_CM3,
ROCK_PI_3A,
ROCK_3B,
ROCK_PI_3C,
)
# Vicharak Boards
_VICHARAK_BOARD_IDS = (VAAMAN, AXON)
# UDOO
_UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",), UDOO_X86: ("dummy",)}
# SeeedStudio boards
_SEEED_BOARD_IDS = (ODYSSEY_X86J41X5,)
# MaaXBoard boards
_MAAXBOARD_IDS = ("MAAXBOARD", "MAAXBOARD_MINI")
# Lichee RISC-V boards
_LICHEE_RISCV_IDS = (LICHEE_RV, LICHEEPI_4A)
# Siemens Simatic IOT2000 Gateways
SIEMENS_SIMATIC_IOT2050_ADV = "SIEMENS_SIMATIC_IOT2050_ADVANCED"
SIEMENS_SIMATIC_IOT2050_BASIC = "SIEMENS_SIMATIC_IOT2050_BASIC"
# Siemens Simatic IOT2000 Gateways
_SIEMENS_SIMATIC_IOT2000_IDS = (
SIEMENS_SIMATIC_IOT2050_ADV,
SIEMENS_SIMATIC_IOT2050_BASIC,
)
# Libre Computer Boards
AML_S905X_CC = "AML-S905X-CC"
ROC_RK3328_CC = "ROC-RK3328-CC"
# Libre Computer Boards
_LIBRE_COMPUTER_IDS = (
AML_S905X_CC,
ROC_RK3328_CC,
)
# NXP System on Module Computer boards
NXP_IMX8MPLUS_SOM = "NXP_IMX8MPLUS_SOM"
_NXP_SOM_IDS = (NXP_IMX8MPLUS_SOM,)
# Repka-Pi boards
REPKA_PI_3_H5 = "REPKA_PI_3_H5"
REPKA_PI_4_H6 = "REPKA_PI_4_H6"
# Repka-Pi
_REPKA_PI_IDS = (
REPKA_PI_3_H5,
REPKA_PI_4_H6,
)
_MILKV_IDS_ = (MILKV_DUO,)
# Luckfox
_LUCKFOX_IDS = (
LUCKFOX_PICO,
LUCKFOX_PICO_MAX,
LUCKFOX_PICO_MINI,
LUCKFOX_PICO_PLUS,
)
# Horizon
_HORIZON_IDS = (RDK_X3,)
_AMERIDROID_IDS = (INDIEDROID_NOVA,)
# Particle
_PARTICLE_IDS = (PARTICLE_TACHYON,)
# Agnostic board
OS_AGNOSTIC_BOARD = "OS_AGNOSTIC_BOARD"

View file

@ -1,94 +0,0 @@
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Definition of chips."""
A311D = "A311D"
OS_AGNOSTIC = "OS_AGNOSTIC"
AM33XX = "AM33XX"
AM625X = "AM625X"
AM65XX = "AM65XX"
AM67A = "AM67A"
DRA74X = "DRA74X"
TDA4VM = "TDA4VM"
IMX6ULL = "IMX6ULL"
IMX8MX = "IMX8MX"
IMX8MP = "IMX8MP"
BCM2XXX = "BCM2XXX"
ESP8266 = "ESP8266"
EXYNOS5422 = "EXYNOS5422"
RYZEN_V1202B = "RYZEN_V1202B"
RYZEN_V1605B = "RYZEN_V1605B"
SAMD21 = "SAMD21"
SUN4I = "SUN4I"
SUN7I = "SUN7I"
SUN8I = "SUN8I"
S805 = "S805"
S905 = "S905"
S905X = "S905X"
S905X3 = "S905X3"
S905Y2 = "S905Y2"
S922X = "S922X"
SAMA5 = "SAMA5"
T210 = "T210"
T186 = "T186"
T194 = "T194"
T234 = "T234"
APQ8016 = "APQ8016"
GENERIC_X86 = "GENERIC_X86"
FT232H = "FT232H"
FT2232H = "FT2232H"
FT4232H = "FT4232H"
HFU540 = "HFU540"
C906 = "C906"
JH71X0 = "JH71X0"
JH7110 = "JH7110"
MCP2221 = "MCP2221"
BINHO = "BINHO"
MIPS24KC = "MIPS24KC"
MIPS24KEC = "MIPS24KEC"
ZYNQ7000 = "ZYNQ7000"
A10 = "A10"
A20 = "A20"
A64 = "A64"
H6 = "H6"
A33 = "A33"
H5 = "H5"
H3 = "H3"
H616 = "H616"
H618 = "H618"
T527 = "T527"
RK3308 = "RK3308"
RK3399 = "RK3399"
RK3399_T = "RK3399_T"
RK3399PRO = "RK3399PRO"
RK3328 = "RK3328"
LPC4330 = "LPC4330"
RK3288 = "RK3288"
RK3566 = "RK3566"
RK3568 = "RK3568"
RK3588 = "RK3588"
RK3588S = "RK3588S"
RV1103 = "RV1103"
RV1106 = "RV1106"
PENTIUM_N3710 = "PENTIUM_N3710" # SOC Braswell core
CELERON_N5105 = "CELERON_N5105"
STM32F405 = "STM32F405"
RP2040 = "RP2040"
STM32MP157 = "STM32MP157"
STM32MP157DAA1 = "STM32MP157DAA1"
MT8167 = "MT8167"
ATOM_X5_Z8350 = "X5-Z8350"
RP2040_U2IF = "RP2040_U2IF"
D1_RISCV = "D1_RISCV"
ATOM_J4105 = "ATOM_J4105"
TH1520 = "TH1520"
K1 = "K1"
RZV2N = "RZV2N"
RZV2H = "RZV2H"
SUNRISE_X3 = "SUNRISE_X3"
QCM6490 = "QCM6490"
BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2712", "BCM2835", "BCM2837"}
CV1800B = "CV1800B"

View file

@ -1,306 +0,0 @@
# SPDX-FileCopyrightText: 2023 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_platformdetect.revcodes`
================================================================================
Class to help with Raspberry Pi Rev Codes
* Author(s): Melissa LeBlanc-Williams
Implementation Notes
--------------------
**Software and Dependencies:**
* Linux and Python 3.7 or Higher
Data values from https://github.com/raspberrypi/documentation/blob/develop/
documentation/asciidoc/computers/raspberry-pi/revision-codes.adoc#new-style-revision-codes
"""
NEW_OVERVOLTAGE = (
"Overvoltage allowed",
"Overvoltage disallowed",
)
NEW_OTP_PROGRAM = (
"OTP programming is allowed",
"OTP programming is disallowed",
)
NEW_OTP_READ = (
"OTP reading is allowed",
"OTP reading is disallowed",
)
NEW_WARRANTY_BIT = (
"Warranty is intact",
"Warranty has been voided by overclocking",
)
NEW_REV_STYLE = (
"Old-style revision",
"New-style revision",
)
NEW_MEMORY_SIZE = (
"256MB",
"512MB",
"1GB",
"2GB",
"4GB",
"8GB",
)
NEW_MANUFACTURER = (
"Sony UK",
"Egoman",
"Embest",
"Sony Japan",
"Embest",
"Stadium",
)
NEW_PROCESSOR = (
"BCM2835",
"BCM2836",
"BCM2837",
"BCM2711",
"BCM2712",
)
PI_TYPE = {
0x00: "A",
0x01: "B",
0x02: "A+",
0x03: "B+",
0x04: "2B",
0x05: "Alpha (early prototype)",
0x06: "CM1",
0x08: "3B",
0x09: "Zero",
0x0A: "CM3",
0x0B: "Custom",
0x0C: "Zero W",
0x0D: "3B+",
0x0E: "3A+",
0x0F: "Internal use only",
0x10: "CM3+",
0x11: "4B",
0x12: "Zero 2 W",
0x13: "400",
0x14: "CM4",
0x15: "CM4S",
0x17: "5",
0x18: "CM5",
0x19: "500",
0x1A: "CM5 Lite",
}
OLD_MANUFACTURER = (
"Sony UK",
"Egoman",
"Embest",
"Qisda",
)
OLD_MEMORY_SIZE = ("256MB", "512MB", "256MB/512MB")
NEW_REV_STRUCTURE = {
"overvoltage": (31, 1, NEW_OVERVOLTAGE),
"otp_program": (30, 1, NEW_OTP_PROGRAM),
"otp_read": (29, 1, NEW_OTP_READ),
"warranty": (25, 1, NEW_WARRANTY_BIT),
"rev_style": (23, 1, NEW_REV_STYLE),
"memory_size": (20, 3, NEW_MEMORY_SIZE),
"manufacturer": (16, 4, NEW_MANUFACTURER),
"processor": (12, 4, NEW_PROCESSOR),
"type": (4, 8, PI_TYPE),
"revision": (0, 4, int),
}
OLD_REV_STRUCTURE = {
"type": (0, PI_TYPE),
"revision": (1, float),
"memory_size": (2, OLD_MEMORY_SIZE),
"manufacturer": (3, OLD_MANUFACTURER),
}
OLD_REV_EXTRA_PROPS = {
"warranty": (24, 1, NEW_WARRANTY_BIT),
}
OLD_REV_LUT = {
0x02: (1, 1.0, 0, 1),
0x03: (1, 1.0, 0, 1),
0x04: (1, 2.0, 0, 0),
0x05: (1, 2.0, 0, 3),
0x06: (1, 2.0, 0, 1),
0x07: (0, 2.0, 0, 1),
0x08: (0, 2.0, 0, 0),
0x09: (0, 2.0, 0, 3),
0x0D: (1, 2.0, 1, 1),
0x0E: (1, 2.0, 1, 0),
0x0F: (1, 2.0, 1, 1),
0x10: (3, 1.2, 1, 0),
0x11: (6, 1.0, 1, 0),
0x12: (2, 1.1, 0, 0),
0x13: (3, 1.2, 1, 2),
0x14: (6, 1.0, 1, 2),
0x15: (2, 1.1, 2, 2),
}
class PiDecoder:
"""Raspberry Pi Revision Code Decoder"""
def __init__(self, rev_code):
try:
self.rev_code = int(rev_code, 16) & 0xFFFFFFFF
except ValueError:
print("Invalid revision code. It should be a hexadecimal value.")
def is_valid_code(self):
"""Quickly check the validity of a code"""
if self.is_new_format():
for code_format in NEW_REV_STRUCTURE.values():
lower_bit, bit_size, values = code_format
prop_value = (self.rev_code >> lower_bit) & ((1 << bit_size) - 1)
if not self._valid_value(prop_value, values):
return False
else:
if (
self.rev_code & 0xFFFF
) not in OLD_REV_LUT.keys(): # pylint: disable=consider-iterating-dictionary
return False
for code_format in OLD_REV_STRUCTURE.values():
index, values = code_format
code_format = OLD_REV_LUT[self.rev_code & 0xFFFF]
if index >= len(code_format):
return False
if not self._valid_value(code_format[index], values):
return False
return True
def _get_rev_prop_value(self, name, structure=None, raw=False):
if structure is None:
structure = NEW_REV_STRUCTURE
if name not in structure.keys():
raise ValueError(f"Unknown property {name}")
lower_bit, bit_size, values = structure[name]
prop_value = self._get_bits_value(lower_bit, bit_size)
if not self._valid_value(prop_value, values):
raise ValueError(f"Invalid value {prop_value} for property {name}")
if raw:
return prop_value
return self._format_value(prop_value, values)
def _get_bits_value(self, lower_bit, bit_size):
return (self.rev_code >> lower_bit) & ((1 << bit_size) - 1)
def _get_old_rev_prop_value(self, name, raw=False):
if (
name
not in OLD_REV_STRUCTURE.keys() # pylint: disable=consider-iterating-dictionary
):
raise ValueError(f"Unknown property {name}")
index, values = OLD_REV_STRUCTURE[name]
data = OLD_REV_LUT[self.rev_code & 0xFFFF]
if index >= len(data):
raise IndexError(f"Index {index} out of range for property {name}")
if not self._valid_value(data[index], values):
raise ValueError(f"Invalid value {data[index]} for property {name}")
if raw:
return data[index]
return self._format_value(data[index], values)
@staticmethod
def _format_value(value, valid_values):
if valid_values is float or valid_values is int:
return valid_values(value)
return valid_values[value]
@staticmethod
def _valid_value(value, valid_values):
if valid_values is float or valid_values is int:
return isinstance(value, valid_values)
if isinstance(valid_values, (tuple, list)) and 0 <= value < len(valid_values):
return True
if isinstance(valid_values, dict) and value in valid_values.keys():
return True
return False
def _get_property(self, name, raw=False):
if name not in NEW_REV_STRUCTURE:
raise ValueError(f"Unknown property {name}")
if self.is_new_format():
return self._get_rev_prop_value(name, raw=raw)
if name in OLD_REV_EXTRA_PROPS:
return self._get_rev_prop_value(
name, structure=OLD_REV_EXTRA_PROPS, raw=raw
)
return self._get_old_rev_prop_value(name, raw=raw)
def is_new_format(self):
"""Check if the code is in the new format"""
return self._get_rev_prop_value("rev_style", raw=True) == 1
@property
def overvoltage(self):
"""Overvoltage allowed/disallowed"""
return self._get_property("overvoltage")
@property
def warranty_bit(self):
"""Warranty bit"""
return self._get_property("warranty")
@property
def otp_program(self):
"""OTP programming allowed/disallowed"""
return self._get_property("otp_program")
@property
def otp_read(self):
"""OTP reading allowed/disallowed"""
return self._get_property("otp_read")
@property
def rev_style(self):
"""Revision Code style"""
# Force new style for Rev Style
return self._get_rev_prop_value("rev_style")
@property
def memory_size(self):
"""Memory size"""
return self._get_property("memory_size")
@property
def manufacturer(self):
"""Manufacturer"""
return self._get_property("manufacturer")
@property
def processor(self):
"""Processor"""
return self._get_property("processor")
@property
def type(self):
"""Specific Model"""
return self._get_property("type")
@property
def type_raw(self):
"""Raw Value of Specific Model"""
return self._get_property("type", raw=True)
@property
def revision(self):
"""Revision Number"""
return self._get_property("revision")

View file

@ -1,127 +1,20 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`bin.detect`
================================================================================
Board detection and determination script
* Author(s): Melissa LeBlanc-Williams
Implementation Notes
--------------------
**Software and Dependencies:**
* Linux and Python 3.7 or Higher
"""
import adafruit_platformdetect
detector = adafruit_platformdetect.Detector()
print("Board Detection Test")
print()
print("Check that the Chip and Board IDs match your board and that this it is")
print("correctly detecting whether or not it is a Linux board.")
print()
print("Chip id: ", detector.chip.id)
print("Board id: ", detector.board.id)
print()
print("Linux Detection")
print("---------------")
print("Is this a 96Boards board?", detector.board.LINARO_96BOARDS)
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_40_pin)
print("Is this a BBB?", detector.board.BEAGLEBONE_BLACK)
print("Is this an Orange Pi PC?", detector.board.ORANGE_PI_PC)
print("Is this an embedded Linux system?", detector.board.any_embedded_linux)
print()
print("Raspberry Pi Boards")
print("-------------------")
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)
if detector.board.any_raspberry_pi:
print("Raspberry Pi detected.")
print("Is this a Pi 3B+?", detector.board.RASPBERRY_PI_3B_PLUS)
print("Is this a Pi 4B?", detector.board.RASPBERRY_PI_4B)
print("Is this a 40-pin Raspberry Pi?", detector.board.any_raspberry_pi_40_pin)
print("Is this a Raspberry Pi Compute Module?", detector.board.any_raspberry_pi_cm)
print()
print("Other Boards")
print("-------------------")
print(
"Is this a Siemens Simatic IOT2000 Gateway?",
detector.board.any_siemens_simatic_iot2000,
)
print("Is this a 96boards board?", detector.board.any_96boards)
print("Is this a BeagleBone board?", detector.board.any_beaglebone)
print("Is this a Giant board?", detector.board.any_giant_board)
print("Is this a Coral Dev board?", detector.board.any_coral_board)
print("Is this a MaaXBoard?", detector.board.any_maaxboard)
print("Is this a SiFive board? ", detector.board.any_sifive_board)
print("Is this a PYNQ board?", detector.board.any_pynq_board)
print("Is this a Rock Pi board?", detector.board.any_rock_pi_board)
print("Is this a NanoPi board?", detector.board.any_nanopi)
print("Is this a Khadas VIM3 board?", detector.board.khadas_vim3_40_pin)
print("Is this a Clockwork Pi board?", detector.board.any_clockwork_pi_board)
print("Is this a Seeed Board?", detector.board.any_seeed_board)
print("Is this a UDOO board?", detector.board.any_udoo_board)
print("Is this an ASUS Tinker board?", detector.board.any_asus_tinker_board)
print("Is this an STM32MP1 board?", detector.board.any_stm32mp1)
print("Is this a MilkV board?", detector.board.any_milkv_board)
print("Is this a Luckfox Pico board?", detector.board.any_luckfox_pico_board)
print("Is this a generic Linux PC?", detector.board.generic_linux)
print(
"Is this an OS environment variable special case?", detector.board.os_environ_board
)
if detector.board.any_bananapi:
print("Bananapi board detected.")
if detector.board.any_jetson_board:
print("Jetson platform detected.")
if detector.board.any_tisk_board:
print("TI platform detected.")
if detector.board.any_pynq_board:
print("PYNQ platform detected.")
if detector.board.any_orange_pi:
print("Orange Pi detected.")
if detector.board.any_lemaker:
print("LeMaker board detected.")
if detector.board.any_odroid_40_pin:
print("Odroid detected.")
if detector.board.any_onion_omega_board:
print("Onion Omega detected.")
if detector.board.any_pine64_board:
print("Pine64 device detected.")
if detector.board.any_rock_pi_board:
print("Rock Pi device detected.")
if detector.board.any_clockwork_pi_board:
print("Clockwork Pi device detected.")
if detector.board.any_asus_tinker_board:
print("ASUS Tinker Board device detected.")
if detector.board.any_coral_board:
print("Coral device detected.")
if detector.board.any_lubancat:
print("LubanCat detected.")
if detector.board.any_siemens_simatic_iot2000:
print("Siemens Simatic IOT2000 Gateway detected.")
if detector.board.any_nxp_navq_board:
print("NXP NavQ board detected.")
if detector.board.any_walnutpi:
print("Walnut Pi detected.")

View file

@ -1,91 +0,0 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`bin.rpi_info`
================================================================================
Interactive mode will prompt for the revision code
Otherwise it will be detected automatically
* Author(s): Melissa LeBlanc-Williams
Implementation Notes
--------------------
**Software and Dependencies:**
* Linux and Python 3.7 or Higher
"""
import sys
import argparse
import adafruit_platformdetect
from adafruit_platformdetect.revcodes import PiDecoder
detector = adafruit_platformdetect.Detector()
parser = argparse.ArgumentParser()
def print_property(label, value):
"""Format and print a property"""
print(f"{label}: {value}")
def main(interactive):
"""Run the program"""
pi_rev_code = detector.board._pi_rev_code() # pylint: disable=protected-access
if pi_rev_code is None:
print("Raspberry Pi not detected. Using interactive mode")
if pi_rev_code is None or interactive:
pi_rev_code = input(
"Enter a Raspberry Pi revision code (e.g. d03114 or 000f): "
)
print_property("Revision Code", pi_rev_code)
try:
decoder = PiDecoder(pi_rev_code)
except ValueError:
print("Invalid revision code. It should be a hexadecimal value.")
sys.exit(1)
if not decoder.is_valid_code():
print(
"Code is invalid. This rev code includes at least one "
"value that is outside of the expected range."
)
sys.exit(1)
if decoder.is_new_format():
print_property("Overvoltage", decoder.overvoltage)
print_property("OTP Program", decoder.otp_program)
print_property("OTP Read", decoder.otp_read)
print_property("Warranty bit", decoder.warranty_bit)
print_property("New flag", decoder.rev_style)
print_property("Memory size", decoder.memory_size)
print_property("Manufacturer", decoder.manufacturer)
print_property("Processor", decoder.processor)
print_property("Type", decoder.type)
print_property("Revision", decoder.revision)
else:
print_property("Warranty bit", decoder.warranty_bit)
print_property("Model", decoder.type)
print_property("Revision", decoder.revision)
print_property("RAM", decoder.memory_size)
print_property("Manufacturer", decoder.manufacturer)
# Main function
if __name__ == "__main__":
parser.add_argument(
"-i", "--interactive", help="Interactive Mode", action="store_true"
)
args = parser.parse_args()
main(args.interactive)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries
SPDX-License-Identifier: CC-BY-4.0

View file

@ -1,11 +0,0 @@
.. If you created a package, create one automodule per module in the package.
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
.. use this format as the module name: "adafruit_foo.foo"
.. automodule:: adafruit_platformdetect.board
:members:
.. automodule:: adafruit_platformdetect.chip
:members:

View file

@ -1,3 +0,0 @@
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT

View file

@ -1,7 +1,3 @@
SPDX-FileCopyrightText: 2009-2014 Robert Nelson <robertcnelson@gmail.com>
SPDX-License-Identifier: MIT
From https://github.com/beagleboard/image-builder
The MIT License (MIT)

109
docs/conf.py Normal file → Executable file
View file

@ -1,13 +1,8 @@
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath('../adafruit_platformdetect'))
# -- General configuration ------------------------------------------------
@ -15,10 +10,9 @@ sys.path.insert(0, os.path.abspath(".."))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
]
# Uncomment the below if you use native CircuitPython modules such as
@ -26,50 +20,42 @@ extensions = [
# autodoc module docs will fail to generate with a warning.
autodoc_mock_imports = ["machine"]
intersphinx_mapping = {
"python": ("https://docs.python.org/3.7", None),
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
}
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),
'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
templates_path = ['_templates']
source_suffix = ".rst"
source_suffix = '.rst'
# The master toctree document.
master_doc = "index"
master_doc = 'index'
# General information about the project.
project = "Adafruit PlatformDetect Library"
copyright = "2017 Adafruit Industries"
author = "Brennen Bearnes"
project = u'Adafruit Blinka Library'
copyright = u'2017 Adafruit Industries'
author = u'Brennen Bearnes'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "1.0.0"
version = u'1.0.0'
# The full version, including alpha/beta/rc tags.
release = "1.0.0"
release = u'1.0.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = [
"_build",
"Thumbs.db",
".DS_Store",
".env",
"CODE_OF_CONDUCT.md",
]
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
# The reST default role (used for this markup: `text`) to use for all
# documents.
@ -81,7 +67,7 @@ default_role = "any"
add_function_parentheses = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
@ -89,51 +75,50 @@ todo_include_todos = False
# If this is True, todo emits a warning for each TODO entries. The default is False.
todo_emit_warnings = True
napoleon_numpy_docstring = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
try:
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
except:
html_theme = "default"
html_theme_path = ["."]
html_theme = 'default'
html_theme_path = ['.']
else:
html_theme_path = ["."]
html_theme_path = ['.']
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
html_favicon = "_static/favicon.ico"
html_static_path = ['_static']
# Output file base name for HTML help builder.
htmlhelp_basename = "AdafruitPlatformDetectLibrarydoc"
htmlhelp_basename = 'AdafruitPlatformDetectLibrarydoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
@ -141,13 +126,8 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
"AdafruitPlatformDetectLibrary.tex",
"AdafruitPlatformDetect Library Documentation",
author,
"manual",
),
(master_doc, 'AdafruitPlatformDetectLibrary.tex', u'AdafruitPlatformDetect Library Documentation',
author, 'manual'),
]
# -- Options for manual page output ---------------------------------------
@ -155,13 +135,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(
master_doc,
"AdafruitPlatformDetectlibrary",
"Adafruit PlatformDetect Library Documentation",
[author],
1,
)
(master_doc, 'AdafruitPlatformDetectlibrary', u'Adafruit PlatformDetect Library Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
@ -170,13 +145,7 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
"AdafruitPlatformDetectLibrary",
"Adafruit PlatformDetect Library Documentation",
author,
"AdafruitPlatformDetectLibrary",
"One line description of project.",
"Miscellaneous",
),
(master_doc, 'AdafruitPlatformDetectLibrary', u'Adafruit PlatformDetect Library Documentation',
author, 'AdafruitPlatformDetectLibrary', 'One line description of project.',
'Miscellaneous'),
]

View file

@ -1,42 +0,0 @@
.. include:: ../README.rst
Table of Contents
=================
.. toctree::
:maxdepth: 4
:hidden:
self
.. toctree::
:caption: API Reference
:maxdepth: 3
api
.. toctree::
:caption: Tutorials
Adding a Single Board Computer to PlatformDetect for Blinka <https://learn.adafruit.com/adding-a-single-board-computer-to-platformdetect-for-blinka>
.. toctree::
:caption: Related Products
.. toctree::
:caption: Other Links
Download <https://github.com/adafruit/Adafruit_Python_PlatformDetect/releases/latest>
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
Discord Chat <https://adafru.it/discord>
Adafruit Learning System <https://learn.adafruit.com>
Adafruit Blog <https://blog.adafruit.com>
Adafruit Store <https://www.adafruit.com>
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View file

@ -1,3 +0,0 @@
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT

View file

@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
sphinx>=4.0.0

View file

@ -1,37 +0,0 @@
# SPDX-FileCopyrightText: 2022 Alec Delaney for Adafruit Industries
#
# SPDX-License-Identifier: MIT
[build-system]
requires = [
"setuptools",
"wheel",
"setuptools-scm",
]
[project]
name = "Adafruit-PlatformDetect"
description = "Platform detection for use by libraries like Adafruit-Blinka."
version = "0.0.0+auto.0"
readme = "README.rst"
authors = [
{name = "Adafruit Industries", email = "circuitpython@adafruit.com"}
]
urls = {Homepage = "https://github.com/adafruit/Adafruit_Python_PlatformDetect"}
license = {text = "MIT"}
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Hardware",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
]
dynamic = ["dependencies"]
[tool.setuptools]
packages = ["adafruit_platformdetect", "adafruit_platformdetect.constants"]
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

0
requirements.txt Normal file → Executable file
View file

45
setup.py Executable file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
import io
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
# Import the README and use it as the long-description.
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
with io.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = '\n' + f.read()
setup(
name='Adafruit-PlatformDetect',
use_scm_version=True,
setup_requires=["setuptools_scm"],
description='Platform detection for use by libraries like Adafruit-Blinka.',
long_description=long_description,
long_description_content_type='text/x-rst',
author='Adafruit Industries',
author_email='circuitpython@adafruit.com',
python_requires='>=3.4.0',
url='https://github.com/adafruit/Adafruit_Python_PlatformDetect',
# If your package is a single module, use this instead of 'packages':
packages=['adafruit_platformdetect'],
install_requires=[],
license='MIT',
classifiers=[
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: Implementation :: MicroPython',
],
)