Skip to content

Remove dependency to simpleio #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Dependencies
This driver depends on:

* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
* `SimpleIO Library <https://github.com/adafruit/Adafruit_CircuitPython_SimpleIO>`_

Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
Expand Down
9 changes: 3 additions & 6 deletions adafruit_rgbled.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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])
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
# SPDX-License-Identifier: Unlicense

Adafruit-Blinka
adafruit-circuitpython-simpleio