Skip to content

adding alternative TLC59711Multi driver implementation #5

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 96 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
96 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
34b214f
tweak
s-light Feb 8, 2020
7059725
Merge branch 'master' into multi
s-light Feb 8, 2020
f88c06d
add example
s-light Feb 8, 2020
ee2eedc
change to const & internal const
s-light Feb 10, 2020
36c0b50
remove unused and _debug_print_*
s-light Feb 10, 2020
cfcb217
fix code-style (linebreaks)
s-light Feb 10, 2020
8869b00
tweak set&get 16 and 32bit buffer values
s-light Feb 13, 2020
03b1116
fix things..
s-light Feb 24, 2020
743e0c6
more struct experiments and fixes
s-light Feb 24, 2020
50553bd
linting and code cleanup
s-light Feb 25, 2020
cc7b006
more linting and cleanup
s-light Feb 25, 2020
010fa27
more cleanup
s-light Feb 25, 2020
0dee8f8
rewrite discreet steps as loop
s-light Feb 25, 2020
efde043
more cleanup & tests
s-light Feb 25, 2020
33bd833
cleanup set_channel
s-light Feb 25, 2020
b40ddd0
cleanup unneeded helper functions
s-light Feb 25, 2020
a07c083
speed-optimize
s-light Feb 25, 2020
ebed417
rename example
s-light Feb 25, 2020
5a9bede
fix bug
s-light Feb 25, 2020
d676db9
add example
s-light Feb 25, 2020
dcbc36a
dev: change debug output
s-light Sep 7, 2020
cb08af9
moved modules outside of subfolder
s-light Sep 7, 2020
f285c01
changed module names to remove multiple versions
s-light Sep 7, 2020
8c80698
add backwards compatibility class
s-light Sep 11, 2020
a550437
change example import syntax
s-light Sep 11, 2020
c74191a
Merge branch 'master' of https://github.com/adafruit/Adafruit_Circuit…
s-light Sep 11, 2020
bc69ef2
formating and linting
s-light Sep 11, 2020
21a27d8
run black & linting
s-light Sep 11, 2020
88b0c98
cleanup..
s-light Sep 12, 2020
1179a29
more cleanup
s-light Sep 12, 2020
ee70d97
added minimal first AutoShow class
s-light Sep 12, 2020
17fbcee
fix examples
s-light Sep 12, 2020
9e16d6e
linting..
s-light Sep 12, 2020
3347012
black format
FoamyGuy Sep 12, 2020
e56306a
fix pylint issues for super call
FoamyGuy Sep 12, 2020
56ff1c6
rename minimal to simpletest
s-light Sep 13, 2020
913b596
fix doc
s-light Sep 13, 2020
3ce7ab5
fixed doc
s-light Sep 13, 2020
9513171
another fix
s-light Sep 13, 2020
b09f17a
black format
FoamyGuy Sep 13, 2020
8d92121
fix travis
s-light Sep 13, 2020
d97e601
remove travis
FoamyGuy Sep 28, 2020
25cf233
Merge remote-tracking branch 'origin/multi' into multi
FoamyGuy Sep 28, 2020
ab0dccc
remove travis
FoamyGuy Sep 28, 2020
cbb8a2f
cleanup
s-light Dec 19, 2020
309b482
add detailed explanation
s-light Dec 19, 2020
af12497
revert changes to .pylintrc
s-light Dec 19, 2020
ea3fff7
add simple fancyled rainbow example
s-light Dec 22, 2020
91103cb
run black==19.10b0
s-light Jan 5, 2021
81b9c30
fix pdf to py
s-light Jan 7, 2021
a3e4f27
fix pylint import order
s-light Jan 7, 2021
82cb221
Merge branch 'master' into multi
s-light Apr 27, 2021
13c3636
merge things cleanup....
s-light Apr 27, 2021
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
*.mpy
.idea
*.idea.py
__pycache__
_build
*.pyc
.env
build*
bundles
*.DS_Store
.eggs
dist
**/*.egg-info
**/*.egg-info
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
dist: trusty
sudo: false
language: python
python:
- '3.6'
cache:
pip: true
deploy:
- provider: releases
api_key: "$GITHUB_TOKEN"
file_glob: true
file: "$TRAVIS_BUILD_DIR/bundles/*"
skip_cleanup: true
overwrite: true
on:
tags: true
- provider: pypi
user: adafruit-travis
on:
tags: true
password:
secure: Bb5O7KFF8KzwlRBmKuBD4MXOZfycKyHvsghpaGabp9ckZWy+wqS1kKlYbosXbRuAlF4xeGNMFRDBXDx6nEQFa70ozFqgqfA6CpCDtgQgtGhIQxthurR9Mrob4o9kCzwdG8rk1+XC35Ab290bnwLF27tGUm/qeOKhrK/WPOq1VBe4tKjF1HuPhvFljJFa10w1kST+EeSDOnJr+y5o4Cw8Vdoo++e86h184b0vXFT01nefpRDXtHDnzGT+MT24jnfdkAivKuTODHRih7OgpkiyzZKZgyf7oFkKdPqjA0XODTCmnKH9gzFZJ+aeqQUQt2bHk0+yxezy6BV6HRITpPkYW3hH/TCYSUDNexGx1rfGVWrMs0F9wN2lMWyGEzWH6wnBcXQWiCpnRbQOHEeUA4502TO3Ybk3Brr9Y8uFWAIJiIR3fzk0SmhPOT8GN/stmz7U5KiIaXTxeTJaEmZcokE/9NJtqORNXboM9sDqVcXkN59muibkFKN0Zsg+YPEiieitGQv4bPedmg1lW1Bl4G36Vf/xkX2P8XlDq2f8ADLPdQhcjLuQmxHfUHiWrKonqmEfr49E1DQ+fDqwkOCEG0MykQlN0q1MFiZNs6OPSwW5yjsGLMUsfWHqQXYc5ZXtAp5twRHHqPtdqAaKLSbN1v/a9cNO/8oqn+I4A5L9ImYtFS4=
install:
- pip install -r requirements.txt
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme
- pip install --force-reinstall pylint==1.9.2
script:
- 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
.
- cd docs && sphinx-build -E -W -b html . _build/html && cd ..
54 changes: 30 additions & 24 deletions adafruit_tlc59711.py → adafruit_tlc59711/adafruit_tlc59711.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 protected access is by design for the internal class.
# 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):
Expand All @@ -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:
Expand All @@ -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()
Expand Down Expand Up @@ -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!
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
Loading