Skip to content

Commit cbfa114

Browse files
committed
Sphinx and example updates to match API.
1 parent 74b0f6c commit cbfa114

File tree

7 files changed

+60
-55
lines changed

7 files changed

+60
-55
lines changed

adafruit_led_animation/animation/rainbowsparkle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class RainbowSparkle(Rainbow):
5353
:param pixel_object: The initialised LED object.
5454
:param float speed: Animation refresh rate in seconds, e.g. ``0.1``.
5555
:param float period: Period to cycle the rainbow over in seconds. Default 5.
56+
:param int num_sparkles: The number of sparkles to display. Defaults to 1/20 of the pixel
57+
object length.
5658
:param float step: Color wheel step. Default 1.
5759
:param str name: Name of animation (optional, useful for sequences and debugging).
5860
:param float background_brightness: The brightness of the background rainbow. Defaults to

adafruit_led_animation/animation/sparklepulse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
# THE SOFTWARE.
2323
"""
24-
`adafruit_led_animation.animation.sparklepluse`
24+
`adafruit_led_animation.animation.sparklepulse`
2525
================================================================================
2626
27-
Sparklepulse animation for CircuitPython helper library for LED animations.
27+
Sparkle-pulse animation for CircuitPython helper library for LED animations.
2828
2929
* Author(s): Roy Hooper, dmolavi
3030

docs/api.rst

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
55
.. use this format as the module name: "adafruit_foo.foo"
66
7-
.. automodule:: adafruit_led_animation.animation.animation
7+
.. automodule:: adafruit_led_animation.animation
88
:members:
99

1010
.. automodule:: adafruit_led_animation.color
@@ -19,40 +19,37 @@
1919
.. automodule:: adafruit_led_animation.sequence
2020
:members:
2121

22-
.. automodule:: adafruit_led_animation.animation.rainbow
22+
.. automodule:: adafruit_led_animation.animation.blink
2323
:members:
2424

25-
.. automodule:: adafruit_led_animation.animation.sparkle
25+
.. automodule:: adafruit_led_animation.animation.solid
2626
:members:
2727

28-
.. automodule:: adafruit_led_animation.animation.blink
28+
.. automodule:: adafruit_led_animation.animation.colorcycle
2929
:members:
3030

3131
.. automodule:: adafruit_led_animation.animation.chase
3232
:members:
3333

34-
.. automodule:: adafruit_led_animation.animation.colorcycle
35-
:members:
36-
3734
.. automodule:: adafruit_led_animation.animation.comet
3835
:members:
3936

4037
.. automodule:: adafruit_led_animation.animation.pulse
4138
:members:
4239

43-
.. automodule:: adafruit_led_animation.animation.rainbowchase
40+
.. automodule:: adafruit_led_animation.animation.rainbow
4441
:members:
4542

46-
.. automodule:: adafruit_led_animation.animation.rainbowcomet
43+
.. automodule:: adafruit_led_animation.animation.sparkle
4744
:members:
4845

49-
.. automodule:: adafruit_led_animation.animation.rainbowsparkle
46+
.. automodule:: adafruit_led_animation.animation.rainbowchase
5047
:members:
5148

52-
.. automodule:: adafruit_led_animation.animation.solid
49+
.. automodule:: adafruit_led_animation.animation.rainbowcomet
5350
:members:
5451

55-
.. automodule:: adafruit_led_animation.animation.sparkle
52+
.. automodule:: adafruit_led_animation.animation.rainbowsparkle
5653
:members:
5754

5855
.. automodule:: adafruit_led_animation.animation.sparklepulse

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Uncomment the below if you use native CircuitPython modules such as
2222
# digitalio, micropython and busio. List the modules you use. Without it, the
2323
# autodoc module docs will fail to generate with a warning.
24-
autodoc_mock_imports = ["adafruit_led_animation", "adafruit_led_animation.animation"]
24+
autodoc_mock_imports = []
2525

2626

2727
intersphinx_mapping = {

examples/led_animation_all_animations.py

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,20 @@
99
import board
1010
import neopixel
1111

12-
import adafruit_led_animation.animation.blink
13-
import adafruit_led_animation.animation.sparklepulse
14-
from adafruit_led_animation import animation
12+
import adafruit_led_animation.animation.blink as blink_animation
13+
import adafruit_led_animation.animation.sparklepulse as sparklepulse_animation
14+
import adafruit_led_animation.animation.comet as comet_animation
15+
import adafruit_led_animation.animation.chase as chase_animation
16+
import adafruit_led_animation.animation.pulse as pulse_animation
17+
import adafruit_led_animation.animation.sparkle as sparkle_animation
18+
import adafruit_led_animation.animation.rainbowchase as rainbowchase_animation
19+
import adafruit_led_animation.animation.rainbowsparkle as rainbowsparkle_animation
20+
import adafruit_led_animation.animation.rainbowcomet as rainbowcomet_animation
21+
import adafruit_led_animation.animation.solid as solid_animation
22+
import adafruit_led_animation.animation.colorcycle as colorcycle_animation
23+
import adafruit_led_animation.animation.rainbow as rainbow_animation
1524
from adafruit_led_animation.sequence import AnimationSequence
16-
from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE
25+
from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE, MAGENTA, ORANGE
1726

1827
# Update to match the pin connected to your NeoPixels
1928
pixel_pin = board.D6
@@ -22,40 +31,33 @@
2231

2332
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.2, auto_write=False)
2433

25-
blink = adafruit_led_animation.animation.animation.blink.Blink(
26-
pixels, speed=0.5, color=JADE
27-
)
28-
comet = animation.Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
29-
chase = animation.Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE)
30-
pulse = animation.Pulse(pixels, speed=0.1, period=3, color=AMBER)
31-
sparkle = adafruit_led_animation.animation.animation.sparkle.Sparkle(
32-
pixels, speed=0.1, color=PURPLE, num_sparkles=10
33-
)
34-
solid = adafruit_led_animation.animation.animation.solid.Solid(pixels, color=JADE)
35-
rainbow = adafruit_led_animation.animation.animation.rainbow.Rainbow(
36-
pixels, speed=0.1, period=2
37-
)
38-
sparkle_pulse = adafruit_led_animation.animation.animation.sparklepulse.SparklePulse(
39-
pixels, speed=0.1, period=3, color=JADE
40-
)
41-
rainbow_comet = adafruit_led_animation.animation.animation.rainbowcomet.RainbowComet(
42-
pixels, speed=0.1, tail_length=7, bounce=True
43-
)
44-
rainbow_chase = adafruit_led_animation.animation.animation.rainbowchase.RainbowChase(
34+
blink = blink_animation.Blink(pixels, speed=0.5, color=JADE)
35+
colorcycle = colorcycle_animation.ColorCycle(pixels, speed=0.4, colors=[MAGENTA, ORANGE])
36+
comet = comet_animation.Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
37+
chase = chase_animation.Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE)
38+
pulse = pulse_animation.Pulse(pixels, speed=0.1, period=3, color=AMBER)
39+
sparkle = sparkle_animation.Sparkle(pixels, speed=0.1, color=PURPLE, num_sparkles=10)
40+
solid = solid_animation.Solid(pixels, color=JADE)
41+
rainbow = rainbow_animation.Rainbow(pixels, speed=0.1, period=2)
42+
sparkle_pulse = sparklepulse_animation.SparklePulse(pixels, speed=0.1, period=3, color=JADE)
43+
rainbow_comet = rainbowcomet_animation.RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True)
44+
rainbow_chase = rainbowchase_animation.RainbowChase(
4545
pixels, speed=0.1, size=3, spacing=2, wheel_step=8
4646
)
47+
rainbow_sparkle = rainbowsparkle_animation.RainbowSparkle(pixels, speed=0.1, num_sparkles=15)
4748

4849

4950
animations = AnimationSequence(
5051
comet,
5152
blink,
53+
rainbow_sparkle,
5254
chase,
5355
pulse,
5456
sparkle,
55-
solid,
5657
rainbow,
57-
sparkle_pulse,
58+
solid,
5859
rainbow_comet,
60+
sparkle_pulse,
5961
rainbow_chase,
6062
advance_interval=5,
6163
auto_clear=True,

examples/led_animation_gridmap.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
import board
1111
import neopixel
1212

13-
import adafruit_led_animation.animation.rainbow
14-
import adafruit_led_animation.sequence
15-
from adafruit_led_animation import animation
13+
import adafruit_led_animation.animation.comet as comet_animation
14+
import adafruit_led_animation.animation.rainbowcomet as rainbowcomet_animation
15+
import adafruit_led_animation.animation.rainbowchase as rainbowchase_animation
16+
import adafruit_led_animation.animation.chase as chase_animation
17+
import adafruit_led_animation.animation.rainbow as rainbow_animation
18+
from adafruit_led_animation.sequence import AnimationSequence
1619
from adafruit_led_animation import helper
1720
from adafruit_led_animation.color import PURPLE, JADE, AMBER
1821

@@ -26,29 +29,29 @@
2629
pixels, 8, 4, helper.horizontal_strip_gridmap(8, alternating=False)
2730
)
2831

29-
comet_h = animation.Comet(
32+
comet_h = comet_animation.Comet(
3033
pixel_wing_horizontal, speed=0.1, color=PURPLE, tail_length=3, bounce=True
3134
)
32-
comet_v = animation.Comet(
35+
comet_v = comet_animation.Comet(
3336
pixel_wing_vertical, speed=0.1, color=AMBER, tail_length=6, bounce=True
3437
)
35-
chase_h = animation.Chase(
38+
chase_h = chase_animation.Chase(
3639
pixel_wing_horizontal, speed=0.1, size=3, spacing=6, color=JADE
3740
)
38-
rainbow_chase_v = adafruit_led_animation.animation.animation.rainbowchase.RainbowChase(
41+
rainbow_chase_v = rainbowchase_animation.RainbowChase(
3942
pixel_wing_vertical, speed=0.1, size=3, spacing=2, wheel_step=8
4043
)
41-
rainbow_comet_v = adafruit_led_animation.animation.animation.rainbowcomet.RainbowComet(
44+
rainbow_comet_v = rainbowcomet_animation.RainbowComet(
4245
pixel_wing_vertical, speed=0.1, tail_length=7, bounce=True
4346
)
44-
rainbow_v = adafruit_led_animation.animation.animation.rainbow.Rainbow(
47+
rainbow_v = rainbow_animation.Rainbow(
4548
pixel_wing_vertical, speed=0.1, period=2
4649
)
47-
rainbow_chase_h = adafruit_led_animation.animation.animation.rainbowchase.RainbowChase(
50+
rainbow_chase_h = rainbowchase_animation.RainbowChase(
4851
pixel_wing_horizontal, speed=0.1, size=3, spacing=3
4952
)
5053

51-
animations = adafruit_led_animation.sequence.AnimationSequence(
54+
animations = AnimationSequence(
5255
rainbow_v,
5356
comet_h,
5457
rainbow_comet_v,

examples/led_animation_simpletest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"""
1010
import board
1111
import neopixel
12-
from adafruit_led_animation.animation import Comet, Chase
12+
import adafruit_led_animation.animation.comet as comet_animation
13+
import adafruit_led_animation.animation.chase as chase_animation
1314
from adafruit_led_animation.sequence import AnimationSequence
1415
from adafruit_led_animation.color import PURPLE, WHITE
1516

@@ -20,8 +21,8 @@
2021

2122
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.2, auto_write=False)
2223

23-
comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
24-
chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE)
24+
comet = comet_animation.Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
25+
chase = chase_animation.Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE)
2526

2627
animations = AnimationSequence(comet, chase, advance_interval=5)
2728

0 commit comments

Comments
 (0)