Skip to content

Commit 222014e

Browse files
author
Melissa LeBlanc-Williams
committed
Initial Dotstar Additions
1 parent 2b208ec commit 222014e

File tree

7 files changed

+91
-1
lines changed

7 files changed

+91
-1
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ These drivers depends on:
2525
* `INA219 <https://github.com/adafruit/Adafruit_CircuitPython_INA219>`_
2626
* `Seesaw <https://github.com/adafruit/Adafruit_CircuitPython_seesaw>`_
2727
* `HT16K33 <https://github.com/adafruit/Adafruit_CircuitPython_HT16K33>`_
28+
* `DotStar <https://github.com/adafruit/Adafruit_CircuitPython_DotStar>`_
2829

2930
Please ensure all dependencies are available on the CircuitPython filesystem.
3031
This is easily achieved by downloading
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2019 Melissa LeBlanc-Williams for Adafruit Industries LLC
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
"""
23+
`adafruit_featherwing.dotstar_featherwing`
24+
====================================================
25+
26+
Helper for using the `Dotstar FeatherWing <https://www.adafruit.com/product/3449>`_.
27+
28+
* Author(s): Melissa LeBlanc-Williams
29+
"""
30+
31+
__version__ = "0.0.0-auto.0"
32+
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing.git"
33+
34+
import board
35+
import time
36+
import adafruit_dotstar as dotstar
37+
38+
class DotStarFeatherWing:
39+
"""Class representing a `DotStar FeatherWing
40+
<https://www.adafruit.com/product/3449>`_.
41+
42+
The feather uses pins D13 and D11"""
43+
def __init__(self, clock=board.D13, data=board.D11, brightness=0.2):
44+
"""
45+
:param pin clock: The clock pin for the featherwing
46+
:param pin data: The data pin for the featherwing
47+
:param float brightness: Optional brightness (0.0-1.0) that defaults to 1.0
48+
"""
49+
self._rows = 6
50+
self._columns = 12
51+
self._brightness = brightness
52+
self._dotstar = dotstar.DotStar(clock, data, self._rows * self._columns, brightness=self._brightness)
53+
54+
def fill(self, color):
55+
"""Fills the wing with a color.
56+
Does NOT update the LEDs.
57+
58+
:param (int, int, int) color: the color to fill with
59+
"""
60+
self._dotstar.fill(color)
61+

docs/api.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
.. automodule:: adafruit_featherwing.alphanum_featherwing
1111
:members:
1212

13+
.. automodule:: adafruit_featherwing.dotstar_featherwing
14+
:members:
15+

docs/examples.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ Ensure your device works with this simple test.
1515
:caption: examples/featherwing_alphanum_simpletest.py
1616
:linenos:
1717

18+
.. literalinclude:: ../examples/featherwing_dotstar_simpletest.py
19+
:caption: examples/featherwing_dotstar_simpletest.py
20+
:linenos:
21+
1822

1923

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""This example changes the screen different colors"""
2+
3+
from time import sleep
4+
import random
5+
from adafruit_featherwing import dotstar_featherwing
6+
7+
dotstar = dotstar_featherwing.DotStarFeatherWing()
8+
9+
# HELPERS
10+
# a random color 0 -> 224
11+
def random_color():
12+
return random.randrange(0, 8) * 32
13+
14+
# MAIN LOOP
15+
while True:
16+
# Fill screen with a random color
17+
dotstar.fill((random_color(), random_color(), random_color()))
18+
sleep(.25)

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ adafruit-circuitpython-register
44
adafruit-circuitpython-ina219
55
adafruit-circuitpython-seesaw
66
adafruit-circuitpython-ht16k33
7+
adafruit-circuitpython-dotstar
8+

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737

3838
install_requires=['Adafruit-Blinka', 'adafruit-circuitpython-busdevice',
3939
'adafruit-circuitpython-register', 'adafruit-circuitpython-ina219',
40-
'adafruit-circuitpython-seesaw', 'adafruit-circuitpython-ht16k33'],
40+
'adafruit-circuitpython-seesaw', 'adafruit-circuitpython-ht16k33',
41+
'adafruit-circuitpython-dotstar'],
4142

4243
# Choose your license
4344
license='MIT',

0 commit comments

Comments
 (0)