From 9b70b84d272f55a96212e8fabb34f95717ba553d Mon Sep 17 00:00:00 2001 From: dherrada Date: Sun, 29 Dec 2019 23:42:56 -0500 Subject: [PATCH 1/4] Moved repository from Travis to GitHub Actions --- .github/workflows/build.yml | 15 ++++++++------- .github/workflows/release.yml | 21 +++++++++++++++------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02b63eb..66ce4db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,3 @@ - name: Build CI on: [pull_request, push] @@ -26,15 +25,18 @@ jobs: - name: Versions run: | python3 --version - - uses: actions/checkout@v1 + - name: Checkout Current Repo + uses: actions/checkout@v1 with: submodules: true + - name: Checkout tools repo + uses: actions/checkout@v2 + with: + repository: adafruit/actions-ci-circuitpython-libs + path: actions-ci - name: Install deps run: | - sudo apt-get install -y gettext - pip install -r requirements.txt - pip install circuitpython-build-tools Sphinx sphinx-rtd-theme - pip install --force-reinstall pylint==1.9.2 + source actions-ci/install.sh - name: Library version run: git describe --dirty --always --tags - name: PyLint @@ -46,4 +48,3 @@ jobs: - name: Build docs working-directory: docs run: sphinx-build -E -W -b html . _build/html - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4c87f3a..18efb9c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,3 @@ - name: Release Actions on: @@ -28,14 +27,18 @@ jobs: - name: Versions run: | python3 --version - - uses: actions/checkout@v1 + - name: Checkout Current Repo + uses: actions/checkout@v1 with: submodules: true + - name: Checkout tools repo + uses: actions/checkout@v2 + with: + repository: adafruit/actions-ci-circuitpython-libs + path: actions-ci - name: Install deps run: | - sudo apt-get install -y gettext - pip install -r requirements.txt - pip install circuitpython-build-tools Sphinx sphinx-rtd-theme + source actions-ci/install.sh - name: Build assets run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . - name: Upload Release Assets @@ -54,19 +57,25 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - name: Check For setup.py + id: need-pypi + run: | + echo ::set-output name=setup-py::$( find . -wholename './setup.py' ) - name: Set up Python + if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') uses: actions/setup-python@v1 with: python-version: '3.x' - name: Install dependencies + if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') run: | python -m pip install --upgrade pip pip install setuptools wheel twine - name: Build and publish + if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') env: TWINE_USERNAME: ${{ secrets.pypi_username }} TWINE_PASSWORD: ${{ secrets.pypi_password }} run: | python setup.py sdist twine upload dist/* - From 1099c8cbce6b1b734591e9466786116aeb28b666 Mon Sep 17 00:00:00 2001 From: siddacious Date: Fri, 3 Jan 2020 16:33:48 -0800 Subject: [PATCH 2/4] changing 'full test' to a vref example --- examples/mcp4728_full_test.py | 45 -------------------------------- examples/mcp4728_vref_example.py | 25 ++++++++++++++++++ 2 files changed, 25 insertions(+), 45 deletions(-) delete mode 100644 examples/mcp4728_full_test.py create mode 100644 examples/mcp4728_vref_example.py diff --git a/examples/mcp4728_full_test.py b/examples/mcp4728_full_test.py deleted file mode 100644 index 7f4829c..0000000 --- a/examples/mcp4728_full_test.py +++ /dev/null @@ -1,45 +0,0 @@ -import board -import busio -import adafruit_mcp4728 - -i2c = busio.I2C(board.SCL, board.SDA) -mcp4728 = adafruit_mcp4728.MCP4728(i2c) - -#pylint:disable=no-member -mcp4728.channel_a.vref = adafruit_mcp4728.Vref.VDD # sets the channel to scale between 0v and VDD -mcp4728.channel_b.vref = adafruit_mcp4728.Vref.VDD -mcp4728.channel_c.vref = adafruit_mcp4728.Vref.VDD -mcp4728.channel_d.vref = adafruit_mcp4728.Vref.INTERNAL # scales between 0v and 2.048v - -mcp4728.channel_a.gain = 1 -mcp4728.channel_b.gain = 1 -mcp4728.channel_c.gain = 1 - -# changes the gain to 2 so the channel now scales between 0v and 4.098V (2 x Internal Vref) -mcp4728.channel_d.gain = 2 - - -mcp4728.channel_a.value = 65535 # Voltage = VDD -mcp4728.channel_b.value = int(65535/2) # VDD/2 -mcp4728.channel_c.value = int(65535/4) # VDD/4 - -mcp4728.channel_d.value = int(65535/4) # Vref.INTERNAL/4 * 2 => 2.048/4 * 2 = 2.048/2 = ~ 1.024V - -print("cha value:", mcp4728.channel_a.value) -print("chb value:", mcp4728.channel_b.value) -print("chc value:", mcp4728.channel_c.value) -print("chd value:", mcp4728.channel_d.value) -print() - -print("cha gain:", mcp4728.channel_a.gain) -print("chb gain:", mcp4728.channel_b.gain) -print("chc gain:", mcp4728.channel_c.gain) -print("chd gain:", mcp4728.channel_d.gain) -print() -print("cha vref:", mcp4728.channel_a.vref) -print("chb vref:", mcp4728.channel_b.vref) -print("chc vref:", mcp4728.channel_c.vref) -print("chd vref:", mcp4728.channel_d.vref) - - -mcp4728.save_settings() diff --git a/examples/mcp4728_vref_example.py b/examples/mcp4728_vref_example.py new file mode 100644 index 0000000..b34b09c --- /dev/null +++ b/examples/mcp4728_vref_example.py @@ -0,0 +1,25 @@ +import board +import busio +import adafruit_mcp4728 +from time import sleep + +i2c = busio.I2C(board.SCL, board.SDA) +mcp4728 = adafruit_mcp4728.MCP4728(i2c) + +FULL_VREF_RAW_VALUE = 4095 + +mcp4728.channel_a.raw_value = int(FULL_VREF_RAW_VALUE/2) # VDD/2 +mcp4728.channel_a.vref = adafruit_mcp4728.Vref.VDD # sets the channel to scale between 0v and VDD + +mcp4728.channel_b.raw_value = int(FULL_VREF_RAW_VALUE/2) # VDD/2 +mcp4728.channel_b.vref = adafruit_mcp4728.Vref.INTERNAL +mcp4728.channel_b.gain = 1 + +mcp4728.channel_c.raw_value = int(FULL_VREF_RAW_VALUE/2) # VDD/2 +mcp4728.channel_c.vref = adafruit_mcp4728.Vref.INTERNAL +mcp4728.channel_c.gain = 2 + +mcp4728.save_settings() + +while True: + sleep(1) \ No newline at end of file From 74982902335373610670ae55b55bdf74eef78eb3 Mon Sep 17 00:00:00 2001 From: siddacious Date: Mon, 6 Jan 2020 12:13:30 -0800 Subject: [PATCH 3/4] fixed pylint --- examples/mcp4728_vref_example.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/mcp4728_vref_example.py b/examples/mcp4728_vref_example.py index b34b09c..a4bfb51 100644 --- a/examples/mcp4728_vref_example.py +++ b/examples/mcp4728_vref_example.py @@ -1,13 +1,14 @@ +from time import sleep import board import busio import adafruit_mcp4728 -from time import sleep i2c = busio.I2C(board.SCL, board.SDA) mcp4728 = adafruit_mcp4728.MCP4728(i2c) FULL_VREF_RAW_VALUE = 4095 +#pylint: disable=no-member mcp4728.channel_a.raw_value = int(FULL_VREF_RAW_VALUE/2) # VDD/2 mcp4728.channel_a.vref = adafruit_mcp4728.Vref.VDD # sets the channel to scale between 0v and VDD @@ -22,4 +23,4 @@ mcp4728.save_settings() while True: - sleep(1) \ No newline at end of file + sleep(1) From 5587f0f2b444c0952156a6e1d17020b08dbcd6e5 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Wed, 8 Jan 2020 21:09:22 -0600 Subject: [PATCH 4/4] update pylint examples directive Signed-off-by: sommersoft --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66ce4db..11ce574 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: - name: PyLint run: | pylint $( find . -path './adafruit*.py' ) - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py) + ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace $( find . -path "./examples/*.py" )) - name: Build assets run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . - name: Build docs