Skip to content

Commit 1da2278

Browse files
Merge pull request #22 from Neradoc/remove-simpleio
Remove dependency to simpleio
2 parents dbdff9b + ebe6dce commit 1da2278

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Dependencies
2424
This driver depends on:
2525

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

2928
Please ensure all dependencies are available on the CircuitPython filesystem.
3029
This is easily achieved by downloading

adafruit_rgbled.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@
1717
1818
* Adafruit CircuitPython firmware for the supported boards:
1919
https://github.com/adafruit/circuitpython/releases
20-
21-
* Adafruit's SimpleIO library: https://github.com/adafruit/Adafruit_CircuitPython_SimpleIO
2220
"""
2321
from pwmio import PWMOut
24-
from simpleio import map_range
2522

2623
__version__ = "0.0.0+auto.0"
2724
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_RGBLED.git"
@@ -137,19 +134,19 @@ def color(self, value):
137134
self._current_color = value
138135
if isinstance(value, tuple):
139136
for i in range(0, 3):
140-
color = int(map_range(value[i], 0, 255, 0, 65535))
137+
color = int(max(0, min(65535, value[i] * 257)))
141138
if self._invert_pwm:
142139
color -= 65535
143140
self._rgb_led_pins[i].duty_cycle = abs(color)
144141
elif isinstance(value, int):
145-
if value >> 24:
142+
if value > 0xFFFFFF:
146143
raise ValueError("Only bits 0->23 valid for integer input")
147144
r = value >> 16
148145
g = (value >> 8) & 0xFF
149146
b = value & 0xFF
150147
rgb = [r, g, b]
151148
for color in range(0, 3):
152-
rgb[color] = int(map_range(rgb[color], 0, 255, 0, 65535))
149+
rgb[color] = max(0, min(65535, rgb[color] * 257))
153150
if self._invert_pwm:
154151
rgb[color] -= 65535
155152
self._rgb_led_pins[color].duty_cycle = abs(rgb[color])

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
# SPDX-License-Identifier: Unlicense
44

55
Adafruit-Blinka
6-
adafruit-circuitpython-simpleio

0 commit comments

Comments
 (0)