\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{cmdlist}
	0 & \cname{CLEAR}
	Switch all LEDs off (sets them to black) & \\

	1 & \cname{LOAD}
	Load a sequence of R,G,B bytes
	& \begin{cmdreq}
		\item For each LED:
		\begin{pldlist}
			\cfield{u8} red
			\cfield{u8} green
			\cfield{u8} blue
		\end{pldlist}
	\end{cmdreq} \\

	4 & \cname{LOAD\_U32\_ZRGB}
	Load 32-bit big-endian 0xRRGGBB (0,R,G,B)
	& \begin{cmdreq}
		\cfield{u32[]} color data BE
	\end{cmdreq} \\

	5 & \cname{LOAD\_U32\_ZBGR}
	Load 32-bit big-endian 0xBBGGRR (0,B,G,R)
	& \begin{cmdreq}
		\cfield{u32[]} color data BE
	\end{cmdreq} \\

	6 & \cname{LOAD\_U32\_RGBZ}
	Load 32-bit little-endian 0xBBGGRR (R,G,B,0)
	& \begin{cmdreq}
		\cfield{u32[]} color data LE
	\end{cmdreq} \\

	7 & \cname{LOAD\_U32\_BGRZ}
	Load 32-bit little-endian 0xRRGGBB (B,G,R,0)
	& \begin{cmdreq}
		\cfield{u32[]} color data LE
	\end{cmdreq} \\

	10 & \cname{GET\_LEN}
	Get number of LEDs in the strip
	& \begin{cmdresp}
		\cfield{u16} number of LEDs
	\end{cmdresp} \\

\end{cmdlist}



