GEX thesis source code, full text, references
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
gex-thesis/ch.unit.npx.tex

75 lines
1.7 KiB

\section{NeoPixel Unit}
The NeoPixel unit implements the protocol needed to control a digital LED strip with WS2812, WS2811, or compatible LED driver chips. The protocol timing is implemented in software, therefore it is available on any GPIO pin of the module.
The color data can be loaded in five different format: as packed bytes, or as the little-endian or big-endian encoding of colors in the 32-bit format 0x00RRGGBB or 0x00BBGGRR. This data format is convenient when the colors are already represented by an array of 32-bit integers.
\subsection{NeoPixel Configuration}
\begin{inicode}
[NPX:neo@3]
# Data pin
pin=A0
# Number of pixels
pixels=32
\end{inicode}
\subsection{NeoPixel Commands}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
0 & \flname{CLEAR}
Switch all LEDs off (sets them to black) & \\
1 & \flname{LOAD}
Load a sequence of R,G,B bytes
& \makecell[tl]{
\fldreq
\tabitem For each LED: \\
~~\fldo{u8} red \\
~~\fldo{u8} green \\
~~\fldo{u8} blue \\
} \\
4 & \flname{LOAD\_U32\_ZRGB}
Load 32-bit big-endian 0xRRGGBB (0,R,G,B)
& \makecell[tl]{
\fldreq
\fld{u32[]} color data BE
} \\
5 & \flname{LOAD\_U32\_ZBGR}
Load 32-bit big-endian 0xBBGGRR (0,B,G,R)
& \makecell[tl]{
\fldreq
\fld{u32[]} color data BE
} \\
6 & \flname{LOAD\_U32\_RGBZ}
Load 32-bit little-endian 0xBBGGRR (R,G,B,0)
& \makecell[tl]{
\fldreq
\fld{u32[]} color data LE
} \\
7 & \flname{LOAD\_U32\_BGRZ}
Load 32-bit little-endian 0xRRGGBB (B,G,R,0)
& \makecell[tl]{
\fldreq
\fld{u32[]} color data LE
} \\
10 & \flname{GET\_LEN}
Get number of LEDs in the strip
& \makecell[tl]{
\fldresp
\fld{u16} number of LEDs
} \\
\bottomrule
\end{tabularx}