From 019e24ffc59e6d9134529735e2007dbb973404cb Mon Sep 17 00:00:00 2001
From: danb <danb@hasi.it>
Date: Sat, 31 Aug 2019 14:34:32 +0200
Subject: [PATCH] Add ws2812 module documentation

---
 Documentation/index.rst            |  1 +
 Documentation/pycardium/ws2812.rst | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 Documentation/pycardium/ws2812.rst

diff --git a/Documentation/index.rst b/Documentation/index.rst
index 0607bdaa..56631e81 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -38,6 +38,7 @@ Last but not least, if you want to start hacking the lower-level firmware, the
    pycardium/simple_menu
    pycardium/utime
    pycardium/vibra
+   pycardium/ws2812
 
 .. toctree::
    :maxdepth: 1
diff --git a/Documentation/pycardium/ws2812.rst b/Documentation/pycardium/ws2812.rst
new file mode 100644
index 00000000..91ff691f
--- /dev/null
+++ b/Documentation/pycardium/ws2812.rst
@@ -0,0 +1,30 @@
+.. py:module:: ws2812
+
+``ws2812`` - Neopixel LEDs
+==========================
+The ``ws2812`` module controls LEDs of the WS2812 type. Just as the ``leds`` module, it exposes a function :py:func:`ws2812.set_all`, which works a similar fashion.
+
+.. py:function:: set_all(pin, colors)
+
+   Set multiple of the LEDs to RGB values.
+
+   Filling starts at the LED connected to the specified gpio pin.
+
+   :param int pin: ID of the pin to use for sending the data.
+   :param colors: List of RGB triplets.
+
+   **Example**
+
+   .. code-block:: python
+
+      import color, utime, ws2812, gpio
+
+      i = 0
+      while True:
+          col1 = color.from_hsv(i % 360, 1.0, 0.1)
+          col2 = color.from_hsv((i + 20) % 360, 1.0, 0.1)
+          col3 = color.from_hsv((i + 40) % 360, 1.0, 0.1)
+          ws2812.set_all(gpio.WRISTBAND_2, [col1, col2, col3])
+          i += 1
+          utime.sleep_ms(10)
+
-- 
GitLab