Skip to content
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

adding alternative TLC59711Multi driver implementation #5

Open
wants to merge 43 commits into
base: master
from
Open
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
66aa12c
first starts on multi driver. Not Working.
s-light Nov 16, 2018
80cc33e
fix nameing
s-light Dec 25, 2018
dc0978f
prepared multifile version
s-light Dec 26, 2018
38afd72
make pylama happy :-)
s-light Dec 26, 2018
52fa830
make pylama happy :-)
s-light Dec 26, 2018
f92abd2
debugging...
s-light Jan 5, 2019
6f0eec1
working :joy:
s-light Jan 5, 2019
a60dbdb
fix multichip calculations & remove debugging
s-light Jan 5, 2019
640790e
add timing tests
s-light Jan 5, 2019
d994b23
add lookup variant
s-light Jan 5, 2019
21eccb4
switch to lookup variant
s-light Jan 5, 2019
e6502d9
add set_channel
s-light Jan 5, 2019
6351051
optimize set_pixel
s-light Jan 5, 2019
8b465f0
fix spelling
s-light Jan 5, 2019
a1e754b
optimize speed in set_pixel
s-light Jan 5, 2019
a3c78eb
optimize set_pixel
s-light Jan 5, 2019
3678d59
optimize set_pixel
s-light Jan 5, 2019
849e452
make linter happy
s-light Jan 5, 2019
0589b6d
optimize same more
s-light Jan 5, 2019
c4b398d
fix spelling
s-light Jan 5, 2019
5e3a6e5
added set_pixel_16bit_XXXXX
s-light Jan 5, 2019
4a90e3c
added timing test
s-light Jan 5, 2019
1343d3f
added test for pixel get
s-light Jan 5, 2019
cb52b98
more tests and cleanup
s-light Jan 5, 2019
6a1363b
add set_pixels_all
s-light Jan 5, 2019
5830031
added set_pixel_all_16bit_value
s-light Jan 5, 2019
1d26599
cleanup & change asserts
s-light Jan 5, 2019
748eca7
update
s-light Jan 5, 2019
91bc684
simplified simpletest.py
s-light Jan 5, 2019
3697e48
cleaned up *dev.py
s-light Jan 5, 2019
fd845dd
fixed docu and more cleanup of *dev.py
s-light Jan 5, 2019
4252b1f
made pylint complexity checker happy..
s-light Jan 5, 2019
1f7a36b
more test & clean up
s-light Jan 6, 2019
f3a9888
add bcdata test sketch
s-light Jan 6, 2019
208e77a
update and refine BCData things
s-light Jan 6, 2019
c24ae14
some refines for BC-Data
s-light Jan 6, 2019
186b53e
Merge branch 'master' of https://github.com/adafruit/Adafruit_Circuit…
s-light Jan 6, 2019
6bf3378
fix travis for subfolder.
s-light Jan 6, 2019
ee46c93
make sphinx happy ;-)
s-light Jan 6, 2019
4c93b91
fix linting
s-light Jan 6, 2019
f729757
more linting fixes
s-light Jan 6, 2019
7e42ebc
and more linting / cleaningup...
s-light Jan 6, 2019
4095964
rename internals
s-light Jan 25, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1,5 +1,6 @@
*.mpy
.idea
*.idea.py
__pycache__
_build
*.pyc
@@ -9,4 +10,4 @@ bundles
*.DS_Store
.eggs
dist
**/*.egg-info
**/*.egg-info
@@ -25,7 +25,7 @@ install:
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme
- pip install --force-reinstall pylint==1.9.2
script:
- pylint adafruit_tlc59711.py
- pylint adafruit_tlc59711/*.py
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace
examples/*.py)
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-tlc59711 --library_location
@@ -48,21 +48,21 @@
# Globally disable invalid-name check as this chip by design has short channel
# and register names. It is confusing to rename these from what the datasheet
# refers to them as.
#pylint: disable=invalid-name
# pylint: disable=invalid-name

# Globally disable too many instance attributes check. Again this is a case
# where pylint doesn't have the right context to make this call. The chip by
# design has many channels which must be exposed.
#pylint: disable=too-many-instance-attributes
# pylint: disable=too-many-instance-attributes

# Globally disable protected access. Once again pylint can't figure out the
# context for using internal decorate classes below. In these cases protectected
# access is by design for the internal class.
#pylint: disable=protected-access
# context for using internal decorate classes below.
# In these cases protectected access is by design for the internal class.

This comment has been minimized.

Copy link
@dhalbert
# pylint: disable=protected-access

# Yet another pylint issue, it fails to recognize a decorator class by
# definition has no public methods. Disable the check.
#pylint: disable=too-few-public-methods
# pylint: disable=too-few-public-methods


def _shift_in(target_byte, val):
@@ -83,12 +83,13 @@ class TLC59711:
independent channel by name (r0, g0, b0, r1, b1, etc.) as properties for
fine-grained control.
:param ~busio.SPI spi: An instance of the SPI bus connected to the chip. The clock and
MOSI/outout must be set, the MISO/input is unused.
:param bool auto_show: This is a boolean that defaults to True and indicates any
change to a channel value will instantly be written to the chip. You might wish to
set this to false if you desire to perform your own atomic operations of channel
values. In that case call the show function after making updates to channel state.
:param ~busio.SPI spi: An instance of the SPI bus connected to the chip.
The clock and MOSI/outout must be set, the MISO/input is unused.
:param bool auto_show: This is a boolean that defaults to True and
indicates any change to a channel value will instantly be written
to the chip. You might wish to set this to false if you desire
to perform your own atomic operations of channel values. In that case
call the show function after making updates to channel state.
"""

class _GS_Value:
@@ -105,13 +106,13 @@ def __init__(self, byte_offset):
def __get__(self, obj, obj_type):
# Grab the 16-bit value at the offset for this channel.
return (obj._shift_reg[self._byte_offset] << 8) | \
obj._shift_reg[self._byte_offset+1]
obj._shift_reg[self._byte_offset + 1]

def __set__(self, obj, val):
# Set the 16-bit value at the offset for this channel.
assert 0 <= val <= 65535
obj._shift_reg[self._byte_offset] = (val >> 8) & 0xFF
obj._shift_reg[self._byte_offset+1] = val & 0xFF
obj._shift_reg[self._byte_offset + 1] = val & 0xFF
# Write out the new values if auto_show is enabled.
if obj.auto_show:
obj._write()
@@ -139,7 +140,7 @@ def __set__(self, obj, val):
r0 = _GS_Value(26)


def __init__(self, spi, *, auto_show=True):
def __init__(self, spi, *, auto_show=True): # noqa
self._spi = spi
# This device is just a big 28 byte long shift register without any
# fancy update protocol. Blast out all the bits to update, that's it!
@@ -220,8 +221,9 @@ def show(self):
# Define properties for global brightness control channels.
@property
def red_brightness(self):
"""The red brightness for all channels (i.e. R0, R1, R2, and R3). This is a 7-bit
value from 0-127.
"""The red brightness for all channels (i.e. R0, R1, R2, and R3).
This is a 7-bit value from 0-127.
"""
return self._bcr

@@ -234,8 +236,9 @@ def red_brightness(self, val):

@property
def green_brightness(self):
"""The green brightness for all channels (i.e. G0, G1, G2, and G3). This is a
7-bit value from 0-127.
"""The green brightness for all channels (i.e. G0, G1, G2, and G3).
This is a 7-bit value from 0-127.
"""
return self._bcg

@@ -248,8 +251,9 @@ def green_brightness(self, val):

@property
def blue_brightness(self):
"""The blue brightness for all channels (i.e. B0, B1, B2, and B3). This is a 7-bit
value from 0-127.
"""The blue brightness for all channels (i.e. B0, B1, B2, and B3).
This is a 7-bit value from 0-127.
"""
return self._bcb

@@ -287,9 +291,11 @@ def __setitem__(self, key, val):
"""Set the R, G, B values for the provided channel. Specify a
3-tuple of R, G, B values that are each 16-bit numbers (0-65535).
"""
assert 0 <= key <= 3 # Do this check here instead of later to
# prevent accidentally keeping auto_show
# turned off when a bad key is provided.
# Do this check here instead of later to
# prevent accidentally keeping auto_show
# turned off when a bad key is provided.
assert 0 <= key <= 3

assert len(val) == 3
assert 0 <= val[0] <= 65535
assert 0 <= val[1] <= 65535
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.