Skip to content
Snippets Groups Projects
Verified Commit 282949d1 authored by rahix's avatar rahix
Browse files

doc: Fix minor Pycardium module docs issues


Signed-off-by: default avatarRahix <rahix@rahix.de>
parent c3f473e6
No related branches found
No related tags found
No related merge requests found
...@@ -5,16 +5,21 @@ ...@@ -5,16 +5,21 @@
Set one of the card10's RGB LEDs to a certain color. Set one of the card10's RGB LEDs to a certain color.
Example which sets all LEDs on the top to red::: **Example**:
.. code-block:: python
import leds, color import leds, color
# Set all of the top LEDs to red
for i in range(11): for i in range(11):
leds.set(i, color.RED) leds.set(i, color.RED)
:param led: Which led to set. 0-10 are the leds on the top and 11-14 are the 4 "ambient" leds. :param led: Which led to set. 0-10 are the leds on the top
:param color: What color to set the led to. Should be a :py:class:`color.Color` but any list/tuple and 11-14 are the 4 "ambient" leds.
with 3 elements will work just as well. :param color: What color to set the led to. Should be a
:py:class:`color.Color` but any list/tuple with 3 elements
will work just as well.
.. py:data:: leds.BOTTOM_RIGHT .. py:data:: leds.BOTTOM_RIGHT
......
...@@ -32,10 +32,26 @@ class Color(_ColorTuple): ...@@ -32,10 +32,26 @@ class Color(_ColorTuple):
@classmethod @classmethod
def from_hex(cls, color): def from_hex(cls, color):
""" """
Create a color from a hexadecimal number:: Create a color from a hexadecimal number.
This function is available both as a class method and directly inside
the color module:
**Example**:
.. code-block:: python
from color import Color
# Magenta # Magenta
Color.from_hex(0xff00ff) Color.from_hex(0xff00ff)
.. code-block:: python
import color
# Cyan
color.from_hex(0x00ffff)
""" """
red = (color & 0xff0000) >> 16 red = (color & 0xff0000) >> 16
green = (color & 0x00ff00) >> 8 green = (color & 0x00ff00) >> 8
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment