From f01071c52e174d5475904a8e3c8d4e38305914e4 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Thu, 21 Apr 2022 11:34:28 -0400 Subject: [PATCH 1/5] Add circuitpython_typing, Blinka rev min --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 17a850d..57d0c60 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,5 @@ # # SPDX-License-Identifier: Unlicense -Adafruit-Blinka +Adafruit-Blinka >= 7.0.0 +adafruit-circuitpython-typing From d76b975f8c2b93dd1429f49ba1cdfa05a80d084b Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Thu, 21 Apr 2022 11:35:44 -0400 Subject: [PATCH 2/5] Add circuitpython_typing, Blinka rev min to setup.py --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f65e19b..40e1fa7 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,10 @@ # Author details author="Adafruit Industries", author_email="circuitpython@adafruit.com", - install_requires=["Adafruit-Blinka"], + install_requires=[ + "Adafruit-Blinka>=7.0.0", + "adafruit-circuitpython-typing", + ], # Choose your license license="MIT", # See https://pypi.python.org/pypi?%3Aaction=list_classifiers From 535f6394413f0e49ef5a02b459b80d7da9712ba1 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Thu, 21 Apr 2022 11:50:30 -0400 Subject: [PATCH 3/5] Remove spaces --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 57d0c60..d378f9e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,5 @@ # # SPDX-License-Identifier: Unlicense -Adafruit-Blinka >= 7.0.0 +Adafruit-Blinka>=7.0.0 adafruit-circuitpython-typing From cc6513e995e0f39dd9f7464ed98fe4fe3955ada4 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Thu, 21 Apr 2022 12:17:55 -0400 Subject: [PATCH 4/5] Force circuitpython_typing release with PWMOut --- requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index d378f9e..6212e26 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ # SPDX-License-Identifier: Unlicense Adafruit-Blinka>=7.0.0 -adafruit-circuitpython-typing +adafruit-circuitpython-typing>=1.5.0 diff --git a/setup.py b/setup.py index 40e1fa7..bec1cee 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ author_email="circuitpython@adafruit.com", install_requires=[ "Adafruit-Blinka>=7.0.0", - "adafruit-circuitpython-typing", + "adafruit-circuitpython-typing>=1.5.0", ], # Choose your license license="MIT", From 9123d86e8c64cdcc0b881fe59ebd3755821c2d71 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Thu, 21 Apr 2022 12:18:43 -0400 Subject: [PATCH 5/5] Allow import of PWMOut protocol if pwmio.PWMOut isn't available --- adafruit_motor/motor.py | 7 ++++++- adafruit_motor/servo.py | 6 +++++- adafruit_motor/stepper.py | 7 ++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/adafruit_motor/motor.py b/adafruit_motor/motor.py index 63323d7..3a91871 100644 --- a/adafruit_motor/motor.py +++ b/adafruit_motor/motor.py @@ -23,7 +23,12 @@ try: from typing import Optional, Type from types import TracebackType - from pwmio import PWMOut + + try: + from pwmio import PWMOut + except NotImplementedError: + from circuitpython_typing.pwmio import PWMOut + except ImportError: pass diff --git a/adafruit_motor/servo.py b/adafruit_motor/servo.py index 594cd0c..2412efd 100644 --- a/adafruit_motor/servo.py +++ b/adafruit_motor/servo.py @@ -17,7 +17,11 @@ from types import TracebackType # pylint: disable-msg=unused-import - from pwmio import PWMOut + try: + from pwmio import PWMOut + except NotImplementedError: + from circuitpython_typing.pwmio import PWMOut + except (ImportError, NotImplementedError): pass diff --git a/adafruit_motor/stepper.py b/adafruit_motor/stepper.py index 4bd8059..97cf26c 100755 --- a/adafruit_motor/stepper.py +++ b/adafruit_motor/stepper.py @@ -20,8 +20,13 @@ try: from typing import Union, Optional - from pwmio import PWMOut from digitalio import DigitalInOut + + try: + from pwmio import PWMOut + except NotImplementedError: + from circuitpython_typing.pwmio import PWMOut + except ImportError: pass