From: Carter Nelson Date: Mon, 4 Oct 2021 17:41:19 +0000 (-0700) Subject: Merge pull request #501 from fgervais/mcp2221-empty-i2c-payload X-Git-Tag: 6.14.0~1 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/64f9d7f1205ce7a20940d8d19b554708c5392780?hp=04727af7b654a50b4611d328217c0d8d0b1ffd84 Merge pull request #501 from fgervais/mcp2221-empty-i2c-payload mcp2221: allow empty i2c payload --- 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/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/digitalio.py b/src/digitalio.py index e77d910..ad05cb3 100755 --- a/src/digitalio.py +++ b/src/digitalio.py @@ -176,7 +176,7 @@ class DigitalInOut(ContextManaged): @property def value(self): - """Get or Set the Digital Pin Value""" + """The Digital Pin Value""" return self._pin.value() == 1 @value.setter @@ -188,7 +188,7 @@ class DigitalInOut(ContextManaged): @property def pull(self): - """Get or Set the Digital Pin Direction""" + """The pin pull direction""" if self.direction is Direction.INPUT: return self.__pull raise AttributeError("Not an input") @@ -215,7 +215,7 @@ class DigitalInOut(ContextManaged): @property def drive_mode(self): - """Get or Set the Digital Pin Drive Mode""" + """The Digital Pin Drive Mode""" if self.direction is Direction.OUTPUT: return self.__drive_mode # raise AttributeError("Not an output") 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 """