]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Merge branch 'u2if' of https://github.com/lesamouraipourpre/Adafruit_Blinka into...
authorMelissa LeBlanc-Williams <melissa@adafruit.com>
Thu, 15 Jul 2021 18:55:57 +0000 (11:55 -0700)
committerMelissa LeBlanc-Williams <melissa@adafruit.com>
Thu, 15 Jul 2021 18:55:57 +0000 (11:55 -0700)
.github/workflows/build.yml
setup.py
src/adafruit_blinka/microcontroller/bcm283x/pulseio/PulseIn.py
src/adafruit_blinka/microcontroller/tegra/t186/pin.py
src/busio.py
src/rainbowio.py [new file with mode: 0644]

index f00cbfe4231e70a782eb36d472f4c7ac4d38e9b4..95bdea1fb9d332143cee8077169705f8e40f053d 100644 (file)
@@ -35,7 +35,7 @@ jobs:
         source actions-ci/install.sh
     - name: Pip install pylint, black, & Sphinx
       run: |
-        pip install --force-reinstall pylint black Sphinx sphinx-rtd-theme
+        pip install --force-reinstall pylint==2.7.1 black Sphinx sphinx-rtd-theme
     - name: Library version
       run: git describe --dirty --always --tags
     - name: Check formatting
index 5d6ea95a44300b0aac6180b3a28fc2b0050440b8..576afbdca29645bfa187c37de958fbae7b3b6e70 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -57,6 +57,7 @@ setup(
         "pulseio",
         "pwmio",
         "neopixel_write",
+        "rainbowio",
     ],
     package_data={
         "adafruit_blinka.microcontroller.bcm283x.pulseio": ["libgpiod_pulsein"]
index fd9febee7dabdbe70f5fec1bd3d9810fb2943b43..19dc98f32089364b6e266712f07ce39038dda5e1 100644 (file)
@@ -25,7 +25,7 @@ def final():
 
 atexit.register(final)
 
-# pylint: disable=c-extension-no-member, consider-using-with
+# pylint: disable=c-extension-no-member
 class PulseIn:
     """PulseIn Class to read PWM signals"""
 
index f728a40e26f5a734b8142be40f7a803ce264d0f2..2191c260178de15fe3fa6f40bb601db79c5aeb7f 100644 (file)
@@ -94,7 +94,7 @@ I05 = Pin("GPIO_PQ5")
 T03 = Pin("UART1_CTS")
 T02 = Pin("UART1_RTS")
 P17 = Pin("GPIO_EXP_P17")
-AA00 = Pin("CAN0_GPIO0")
+AA00 = Pin("CAN_GPIO0")
 Y01 = Pin("GPIO_MDM2")
 P16 = Pin("GPIO_EXP_P16")
 I04 = Pin("GPIO_PQ4")
index 3057e525acf6fe525fc16d7970fc8345f73698ad..b41b4c4da418937ca01013099718e467e4b7a62c 100755 (executable)
@@ -18,7 +18,7 @@ from adafruit_blinka import Enum, Lockable, agnostic
 from adafruit_blinka.agnostic import board_id, detector
 
 # pylint: disable=import-outside-toplevel,too-many-branches,too-many-statements
-# pylint: disable=too-many-arguments,too-many-function-args,consider-using-with,too-many-return-statements
+# pylint: disable=too-many-arguments,too-many-function-args,too-many-return-statements
 
 
 class I2C(Lockable):
diff --git a/src/rainbowio.py b/src/rainbowio.py
new file mode 100644 (file)
index 0000000..e852d83
--- /dev/null
@@ -0,0 +1,27 @@
+"""
+`rainbowio` - Provides the `colorwheel()` function
+===========================================================
+See `CircuitPython:rainbowio` in CircuitPython for more details.
+Not supported by all boards.
+
+* Author(s): Kattni Rembor
+"""
+
+
+def colorwheel(color_value):
+    """
+    A colorwheel. ``0`` and ``255`` are red, ``85`` is green, and ``170`` is blue, with the values
+    between being the rest of the rainbow.
+
+    :param int color_value: 0-255 of color value to return
+    :return: tuple of RGB values
+    """
+    if color_value < 0 or color_value > 255:
+        return 0, 0, 0
+    if color_value < 85:
+        return 255 - color_value * 3, color_value * 3, 0
+    if color_value < 170:
+        color_value -= 85
+        return 0, 255 - color_value * 3, color_value * 3
+    color_value -= 170
+    return color_value * 3, 0, 255 - color_value * 3