Skip to content

Commit d0e5b30

Browse files
Re-cookiecutter because .py filename change
1 parent 14f5816 commit d0e5b30

File tree

6 files changed

+50
-40
lines changed

6 files changed

+50
-40
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ install:
2626
- pip install pylint circuitpython-build-tools
2727

2828
script:
29-
- pylint adafruit_circuitpython_fancyled.py
29+
- pylint adafruit_fancyled.py
3030
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
31-
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-circuitpython_fancyled --library_location .
31+
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-fancyled --library_location .

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Introduction
33
============
44

5-
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-circuitpython_fancyled/badge/?version=latest
5+
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-fancyled/badge/?version=latest
66

7-
:target: https://circuitpython.readthedocs.io/projects/circuitpython_fancyled/en/latest/
7+
:target: https://circuitpython.readthedocs.io/projects/fancyled/en/latest/
88

99
:alt: Documentation Status
1010

@@ -41,7 +41,7 @@ Contributing
4141
============
4242

4343
Contributions are welcome! Please read our `Code of Conduct
44-
<https://github.com/Adafruit/Adafruit_CircuitPython_CircuitPython_FancyLED/blob/master/CODE_OF_CONDUCT.md>`_
44+
<https://github.com/PaintYourDragon/Adafruit_CircuitPython_fancyled/blob/master/CODE_OF_CONDUCT.md>`_
4545
before contributing to help this project stay welcoming.
4646

4747
Building locally
@@ -66,4 +66,4 @@ Then run the build:
6666

6767
.. code-block:: shell
6868
69-
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-circuitpython_fancyled --library_location .
69+
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-fancyled --library_location .

adafruit_fancyled.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
"""
23-
`adafruit_CircuitPython_FancyLED`
23+
`adafruit_fancyled`
2424
====================================================
2525
2626
TODO(description)

api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
.. If you created a package, create one automodule per module in the package.
33
4-
.. automodule:: adafruit_circuitpython_fancyled
4+
.. automodule:: adafruit_fancyled
55
:members:

conf.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
master_doc = 'README'
3232

3333
# General information about the project.
34-
project = u'Adafruit CircuitPython_FancyLED Library'
34+
project = u'Adafruit fancyled Library'
3535
copyright = u'2017 PaintYourDragon'
3636
author = u'PaintYourDragon'
3737

@@ -96,7 +96,7 @@
9696
html_static_path = ['_static']
9797

9898
# Output file base name for HTML help builder.
99-
htmlhelp_basename = 'AdafruitCircuitpython_fancyledLibrarydoc'
99+
htmlhelp_basename = 'AdafruitFancyledLibrarydoc'
100100

101101
# -- Options for LaTeX output ---------------------------------------------
102102

@@ -122,7 +122,7 @@
122122
# (source start file, target name, title,
123123
# author, documentclass [howto, manual, or own class]).
124124
latex_documents = [
125-
(master_doc, 'AdafruitCircuitPython_FancyLEDLibrary.tex', u'AdafruitCircuitPython_FancyLED Library Documentation',
125+
(master_doc, 'AdafruitfancyledLibrary.tex', u'Adafruitfancyled Library Documentation',
126126
author, 'manual'),
127127
]
128128

@@ -131,7 +131,7 @@
131131
# One entry per manual page. List of tuples
132132
# (source start file, name, description, authors, manual section).
133133
man_pages = [
134-
(master_doc, 'AdafruitCircuitPython_FancyLEDlibrary', u'Adafruit CircuitPython_FancyLED Library Documentation',
134+
(master_doc, 'Adafruitfancyledlibrary', u'Adafruit fancyled Library Documentation',
135135
[author], 1)
136136
]
137137

@@ -141,7 +141,7 @@
141141
# (source start file, target name, title, author,
142142
# dir menu entry, description, category)
143143
texinfo_documents = [
144-
(master_doc, 'AdafruitCircuitPython_FancyLEDLibrary', u'Adafruit CircuitPython_FancyLED Library Documentation',
145-
author, 'AdafruitCircuitPython_FancyLEDLibrary', 'One line description of project.',
144+
(master_doc, 'AdafruitfancyledLibrary', u'Adafruit fancyled Library Documentation',
145+
author, 'AdafruitfancyledLibrary', 'One line description of project.',
146146
'Miscellaneous'),
147147
]

examples/cpx_rotate.py

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
# Simple FancyLED example for Circuit Playground Express
1+
""" Simple FancyLED example for Circuit Playground Express
2+
"""
23

34
from adafruit_circuitplayground.express import cpx
45
import adafruit_fancyled as fancy
56

7+
# Function names are kept the same as FastLED examples, which normally
8+
# upsets pylint. Disable name-checking so this passes muster.
9+
# pylint: disable=invalid-name
10+
611
# A dynamic gradient palette is a compact representation of a color palette
712
# that lists only the key points (specific positions and colors), which are
813
# later interpolated to produce a full 'normal' color palette.
914
# This one happens to be a blackbody spectrum, it ranges from black to red
1015
# to yellow to white...
11-
blackbody = bytes([
12-
0, 0, 0, 0,
13-
85, 255, 0, 0,
14-
170, 255, 255, 0,
15-
255, 255, 255, 255 ])
16+
BLACKBODY = bytes([
17+
0, 0, 0, 0,
18+
85, 255, 0, 0,
19+
170, 255, 255, 0,
20+
255, 255, 255, 255])
1621

1722
# Here's where we convert the dynamic gradient palette to a full normal
1823
# palette. First we need a list to hold the resulting palette...it can be
@@ -21,32 +26,37 @@
2126
# palettes always have 16, 32 or 256 entries...we can actually use whatever
2227
# length we want in CircuitPython, but for the sake of consistency, let's
2328
# make it a 16-element palette...
24-
palette = [0] * 16
25-
fancy.loadDynamicGradientPalette(blackbody, palette)
29+
PALETTE = [0] * 16
30+
fancy.loadDynamicGradientPalette(BLACKBODY, PALETTE)
2631

2732
# The dynamic gradient step is optional...some projects will just specify
2833
# a whole color palette directly on their own, not expand it from bytes.
2934

30-
# This function fills the Circuit Playground Express NeoPixels from a
31-
# color palette plus an offset to allow us to 'spin' the colors. In
32-
# FancyLED (a la FastLED), palette indices are multiples of 16 (e.g.
33-
# first palette entry is index 0, second is index 16, third is 32, etc)
34-
# and indices between these values will interpolate color between the
35-
# two nearest palette entries.
3635
def FillLEDsFromPaletteColors(palette, offset):
37-
for i in range(10):
38-
# This looks up the color in the palette, scaling from
39-
# 'palette space' (16 colors * 16 interp position = 256)
40-
# to 'pixel space' (10 NeoPixels):
41-
c = fancy.ColorFromPalette(palette,
42-
int(i * len(palette) * 16 / 10 + offset), 255, True)
43-
# Gamma correction gives more sensible-looking colors
44-
cpx.pixels[i] = fancy.applyGamma_video(c)
36+
""" This function fills the Circuit Playground Express NeoPixels from a
37+
color palette plus an offset to allow us to 'spin' the colors. In
38+
FancyLED (a la FastLED), palette indices are multiples of 16 (e.g.
39+
first palette entry is index 0, second is index 16, third is 32, etc)
40+
and indices between these values will interpolate color between the
41+
two nearest palette entries.
42+
"""
43+
44+
for i in range(10):
45+
# This looks up the color in the palette, scaling from
46+
# 'palette space' (16 colors * 16 interp position = 256)
47+
# to 'pixel space' (10 NeoPixels):
48+
color = fancy.ColorFromPalette(palette, int(i * len(palette) * 16 / 10 + offset), 255, True)
49+
# Gamma correction gives more sensible-looking colors
50+
cpx.pixels[i] = fancy.applyGamma_video(color)
4551

4652
# This is an offset (0-255) into the color palette to get it to 'spin'
47-
adjust = 0
53+
ADJUST = 0
4854

4955
while True:
50-
FillLEDsFromPaletteColors(palette, adjust)
51-
adjust += 4 # Bigger number = faster spin
52-
if adjust >= 256: adjust -= 256
56+
FillLEDsFromPaletteColors(PALETTE, ADJUST)
57+
ADJUST += 4 # Bigger number = faster spin
58+
if ADJUST >= 256:
59+
ADJUST -= 256
60+
61+
62+
# pylint: enable=invalid-name

0 commit comments

Comments
 (0)