From 235dc408ecfbdb1356f8b7bae76796f630940809 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 26 Feb 2021 16:26:15 -0500 Subject: [PATCH 1/2] Removed pylint process from github workflow patch 2 --- .github/workflows/build.yml | 4 ---- .pre-commit-config.yaml | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 59baa53..3baf502 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,10 +50,6 @@ jobs: - name: Pre-commit hooks run: | pre-commit run --all-files - - name: PyLint - run: | - pylint $( find . -path './adafruit*.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: Archive bundles diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07f886c..354c761 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,18 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace +- repo: https://github.com/pycqa/pylint + rev: pylint-2.7.1 + hooks: + - id: pylint + name: pylint (library code) + types: [python] + exclude: "^(docs/|examples/|setup.py$)" +- repo: local + hooks: + - id: pylint_examples + name: pylint (examples code) + description: Run pylint rules on "examples/*.py" files + entry: /usr/bin/env bash -c + args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name $example; done)'] + language: system From 937357eab1c4a552b8dd98031c667f67f67100c1 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 2 Mar 2021 09:40:38 -0600 Subject: [PATCH 2/2] pioasm_neopixel: Adapt to various boards On any board with a NEOPIXEL pin defined, use it. Otherwise, arbitrarily use D16 which is conveniently at a corner of the Pico board. Send several different pixel colors so that the user can see it working. --- examples/pioasm_neopixel.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/pioasm_neopixel.py b/examples/pioasm_neopixel.py index a682d94..cf72847 100644 --- a/examples/pioasm_neopixel.py +++ b/examples/pioasm_neopixel.py @@ -5,6 +5,7 @@ import time import rp2pio import board +import microcontroller import adafruit_pioasm # NeoPixels are 800khz bit streams. Zeroes are 1/3 duty cycle (~416ns) and ones @@ -25,21 +26,31 @@ assembled = adafruit_pioasm.assemble(program) +# If the board has a designated neopixel, then use it. Otherwise use +# GPIO16 as an arbitrary choice. +if hasattr(board, "NEOPIXEL"): + NEOPIXEL = board.NEOPIXEL +else: + NEOPIXEL = microcontroller.pin.GPIO16 + sm = rp2pio.StateMachine( assembled, frequency=800000 * 6, # 800khz * 6 clocks per bit - init=adafruit_pioasm.assemble("set pindirs 1"), - first_set_pin=board.D12, - first_sideset_pin=board.D12, + first_set_pin=NEOPIXEL, + first_sideset_pin=NEOPIXEL, auto_pull=True, out_shift_right=False, pull_threshold=8, ) print("real frequency", sm.frequency) -for i in range(100): +for i in range(30): sm.write(b"\x0a\x00\x00") time.sleep(0.1) + sm.write(b"\x00\x0a\x00") + time.sleep(0.1) + sm.write(b"\x00\x00\x0a") + time.sleep(0.1) print("writes done") time.sleep(2)