From: Kattni Date: Tue, 5 Oct 2021 21:51:45 +0000 (-0400) Subject: Merge pull request #506 from makermelissa/pwm64fix X-Git-Tag: 6.14.0 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/40cd06277dcebbbb62eea3d42952f51c2b4a3c92?hp=ee0ac203d106fee2963d0c0deb42e206150995af Merge pull request #506 from makermelissa/pwm64fix Fix libgpiod for 64-bit Pi by detecting and loading appropriate lib --- diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 220e398..ce2635b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,5 +29,8 @@ jobs: TWINE_USERNAME: ${{ secrets.pypi_username }} TWINE_PASSWORD: ${{ secrets.pypi_password }} run: | + for file in $(find -not -path "./.*" -not -path "./docs*" -name "*.py"); do + sed -i -e "s/0.0.0-auto.0/${{github.event.release.tag_name}}/" $file; + done; python setup.py sdist twine upload dist/* diff --git a/README.rst b/README.rst index d802c16..8f3aa29 100755 --- a/README.rst +++ b/README.rst @@ -25,11 +25,13 @@ for devices or hosts running CPython or MicroPython. Working code exists to emul * **board** - breakout-specific pin identities * **busio** - hardware-driven interfaces for I2C, SPI, UART * **digitalio** - digital input/output pins, using pin identities from board+microcontroller packages +* **keypad** - support for scanning keys and key matrices * **microcontroller** - chip-specific pin identities * **micropython** - MicroPython-specific module * **neopixel_write** - low-level interface to NeoPixels * **pulseio** - contains classes that provide access to basic pulse IO (PWM) * **pwmio** - contains classes that provide access to basic pulse IO (PWM) +* **rainbowio** - provides the colorwheel() function For details, see the `Blinka API reference `_. diff --git a/docs/api.rst b/docs/api.rst index 61e9bbe..dc0aeb6 100755 --- a/docs/api.rst +++ b/docs/api.rst @@ -13,6 +13,9 @@ .. automodule:: adafruit_blinka.microcontroller :members: +.. automodule:: analogio + :members: + .. automodule:: bitbangio :members: @@ -25,13 +28,23 @@ .. automodule:: digitalio :members: -.. automodule:: analogio +.. automodule:: keypad :members: -.. automodule:: pulseio +.. automodule:: microcontroller + :members: + +.. automodule:: micropython :members: .. automodule:: neopixel_write :members: +.. automodule:: pulseio + :members: + +.. automodule:: pwmio + :members: +.. automodule:: rainbowio + :members: diff --git a/docs/examples.rst b/docs/examples.rst index c174f0c..5f6211b 100755 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -1,5 +1,37 @@ -examples +Examples -------- -No examples are currently available. See the `CircuitPython docs -`_ for extensive API documentation. +See the `CircuitPython docs `_ for extensive API documentation which should +(mostly) work with Blinka. + +.. literalinclude:: ../examples/analog_in.py + :caption: examples/analog_in.py + :linenos: + +.. literalinclude:: ../examples/bbb_digitalio.py + :caption: examples/bbb_digitalio.py + :linenos: + +.. literalinclude:: ../examples/mcps_busio_i2c.py + :caption: examples/mcps_busio_i2c.py + :linenos: + +.. literalinclude:: ../examples/pb_digitalio.py + :caption: examples/pb_digitalio.py + :linenos: + +.. literalinclude:: ../examples/pi_busio_i2c.py + :caption: examples/pi_busio_i2c.py + :linenos: + +.. literalinclude:: ../examples/pi_busio_spi.py + :caption: examples/pi_busio_spi.py + :linenos: + +.. literalinclude:: ../examples/pi_digitalio.py + :caption: examples/pi_digitalio.py + :linenos: + +.. literalinclude:: ../examples/piblinka.py + :caption: examples/piblinka.py + :linenos: diff --git a/examples/mcps_busio_i2c.py b/examples/mcps_busio_i2c.py old mode 100755 new mode 100644 diff --git a/examples/pi_busio_i2c.py b/examples/pi_busio_i2c.py old mode 100755 new mode 100644 diff --git a/examples/pi_busio_spi.py b/examples/pi_busio_spi.py old mode 100755 new mode 100644 diff --git a/examples/pi_digitalio.py b/examples/pi_digitalio.py old mode 100755 new mode 100644 diff --git a/examples/piblinka.py b/examples/piblinka.py old mode 100755 new mode 100644 diff --git a/setup.py b/setup.py index 576afbd..a18904c 100755 --- a/setup.py +++ b/setup.py @@ -34,7 +34,11 @@ if os.path.exists("/proc/device-tree/compatible"): setup( name="Adafruit-Blinka", - use_scm_version=True, + use_scm_version={ + # This is needed for the PyPI version munging in the Github Actions release.yml + "git_describe_command": "git describe --tags --long", + "local_scheme": "no-local-version", + }, setup_requires=["setuptools_scm"], description="CircuitPython APIs for non-CircuitPython versions of Python such as CPython on Linux and MicroPython.", long_description=long_description, @@ -53,10 +57,11 @@ setup( "board", "busio", "digitalio", + "keypad", "micropython", + "neopixel_write", "pulseio", "pwmio", - "neopixel_write", "rainbowio", ], package_data={ diff --git a/src/adafruit_blinka/board/feather_u2if.py b/src/adafruit_blinka/board/feather_u2if.py index a6ba759..23fe99e 100644 --- a/src/adafruit_blinka/board/feather_u2if.py +++ b/src/adafruit_blinka/board/feather_u2if.py @@ -33,6 +33,8 @@ A1 = pin.GP27 A2 = pin.GP28 # A3 = pin.GP29 # not currently supported in firmware +NEOPIXEL = pin.GP16 + SCL = pin.GP3 SDA = pin.GP2 diff --git a/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py b/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py index 30f45f6..fb9edf3 100644 --- a/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py +++ b/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py @@ -189,7 +189,7 @@ class MCP2221: # bus release will need "a few hundred microseconds" time.sleep(0.001) - # pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments,too-many-branches def _i2c_write(self, cmd, address, buffer, start=0, end=None): if self._i2c_state() != 0x00: self._i2c_cancel() @@ -198,7 +198,7 @@ class MCP2221: length = end - start retries = 0 - while (end - start) > 0: + while (end - start) > 0 or not buffer: chunk = min(end - start, MCP2221_MAX_I2C_DATA_LEN) # write out current chunk resp = self._hid_xfer( @@ -223,6 +223,8 @@ class MCP2221: # yay chunk sent! while self._i2c_state() == RESP_I2C_PARTIALDATA: time.sleep(0.001) + if not buffer: + break start += chunk retries = 0 diff --git a/src/board.py b/src/board.py index af73c13..0de6c10 100755 --- a/src/board.py +++ b/src/board.py @@ -27,6 +27,13 @@ See `CircuitPython:board` in CircuitPython for more details. * Author(s): cefn """ + + +__version__ = "0.0.0-auto.0" +__repo__ = "https://github.com/adafruit/Adafruit_Blinka.git" +__blinka__ = True + + import sys import adafruit_platformdetect.constants.boards as ap_board diff --git a/src/keypad.py b/src/keypad.py index 97c58e7..a156d6e 100644 --- a/src/keypad.py +++ b/src/keypad.py @@ -462,7 +462,7 @@ class ShiftRegisterKeys(_KeysBase): @property def events(self): - """The `EventQueue` associated with this `Keys` object. (read-only)""" + """The ``EventQueue`` associated with this `Keys` object. (read-only)""" return self._events def _keypad_shiftregisterkeys_scan(self): diff --git a/src/microcontroller/__init__.py b/src/microcontroller/__init__.py index 9e05c81..fda16cc 100755 --- a/src/microcontroller/__init__.py +++ b/src/microcontroller/__init__.py @@ -1,4 +1,9 @@ -"""Microcontroller pins""" +""" +`microcontroller` - Pin references and cpu functionality +======================================================== + +* Author(s): Melissa LeBlanc-Williams +""" import sys import time @@ -14,7 +19,12 @@ def delay_us(delay): class Pin(Enum): - """Reference Pin object""" + """ + Identifies an IO pin on the microcontroller. + + They are fixed by the hardware so they cannot be constructed on demand. Instead, use board or + microcontroller.pin to reference the desired pin. + """ def __init__(self, pin_id): """Identifier for pin, referencing platform-specific pin id""" diff --git a/src/micropython.py b/src/micropython.py index 5f369e3..843d5a5 100755 --- a/src/micropython.py +++ b/src/micropython.py @@ -1,6 +1,6 @@ """ `micropython` - MicroPython Specific Decorator Functions -================================================= +======================================================== * Author(s): cefn """