diff --git a/README.rst b/README.rst index 297f952..a2e3817 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,6 @@ Dependencies This driver depends on: * `Adafruit CircuitPython `_ -* `SimpleIO Library `_ Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading diff --git a/adafruit_rgbled.py b/adafruit_rgbled.py index 3a59ab0..8a1bf56 100644 --- a/adafruit_rgbled.py +++ b/adafruit_rgbled.py @@ -17,11 +17,8 @@ * Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases - -* Adafruit's SimpleIO library: https://github.com/adafruit/Adafruit_CircuitPython_SimpleIO """ from pwmio import PWMOut -from simpleio import map_range __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_RGBLED.git" @@ -137,19 +134,19 @@ def color(self, value): self._current_color = value if isinstance(value, tuple): for i in range(0, 3): - color = int(map_range(value[i], 0, 255, 0, 65535)) + color = int(max(0, min(65535, value[i] * 257))) if self._invert_pwm: color -= 65535 self._rgb_led_pins[i].duty_cycle = abs(color) elif isinstance(value, int): - if value >> 24: + if value > 0xFFFFFF: raise ValueError("Only bits 0->23 valid for integer input") r = value >> 16 g = (value >> 8) & 0xFF b = value & 0xFF rgb = [r, g, b] for color in range(0, 3): - rgb[color] = int(map_range(rgb[color], 0, 255, 0, 65535)) + rgb[color] = max(0, min(65535, rgb[color] * 257)) if self._invert_pwm: rgb[color] -= 65535 self._rgb_led_pins[color].duty_cycle = abs(rgb[color]) diff --git a/requirements.txt b/requirements.txt index 0e9fd8b..7a984a4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,3 @@ # SPDX-License-Identifier: Unlicense Adafruit-Blinka -adafruit-circuitpython-simpleio