GEX thesis source code, full text, references

ch.unit.npx.tex 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. \section{NeoPixel Unit}
  2. The NeoPixel unit implements the protocol needed to control a digital \gls{LED} strip with WS2812, WS2811, or compatible \gls{LED} driver chips. The NeoPixel protocol (explained in \cref{sec:theory_neo}) is implemented in software, therefore it is available on any \gls{GPIO} pin of the module.
  3. The color data can be loaded in five different formats: as packed bytes (3$\times$8 bits color), or as the little- or big-endian encoding of colors in a 32-bit format: 0x00RRGGBB or 0x00BBGGRR. The 32-bit format is convenient when the colors are already represented as an array of 32-bit integers, e.g., extracted from a screen capture or an image.
  4. \subsection{NeoPixel Configuration}
  5. \begin{inicode}
  6. [NPX:neo@3]
  7. # Data pin
  8. pin=A0
  9. # Number of pixels
  10. pixels=32
  11. \end{inicode}
  12. \subsection{NeoPixel Commands}
  13. \begin{cmdlist}
  14. 0 & \cname{CLEAR}
  15. Switch all \glspl{LED} off (sets them to black) & \\
  16. 1 & \cname{LOAD}
  17. Load a sequence of R,G,B bytes
  18. & \begin{cmdreq}
  19. \item For each \glspl{LED}:
  20. \begin{pldlist}
  21. \cfield{u8} red
  22. \cfield{u8} green
  23. \cfield{u8} blue
  24. \end{pldlist}
  25. \end{cmdreq} \\
  26. 4 & \cname{LOAD\_U32\_ZRGB}
  27. Load 32-bit big-endian 0xRRGGBB (0,R,G,B)
  28. & \begin{cmdreq}
  29. \cfield{u32[]} color data (big-endian)
  30. \end{cmdreq} \\
  31. 5 & \cname{LOAD\_U32\_ZBGR}
  32. Load 32-bit big-endian 0xBBGGRR (0,B,G,R)
  33. & \begin{cmdreq}
  34. \cfield{u32[]} color data (big-endian)
  35. \end{cmdreq} \\
  36. 6 & \cname{LOAD\_U32\_RGBZ}
  37. Load 32-bit little-endian 0xBBGGRR (R,G,B,0)
  38. & \begin{cmdreq}
  39. \cfield{u32[]} color data (little-endian)
  40. \end{cmdreq} \\
  41. 7 & \cname{LOAD\_U32\_BGRZ}
  42. Load 32-bit little-endian 0xRRGGBB (B,G,R,0)
  43. & \begin{cmdreq}
  44. \cfield{u32[]} color data (little-endian)
  45. \end{cmdreq} \\
  46. 10 & \cname{GET\_LEN}
  47. Get number of \glspl{LED} in the strip
  48. & \begin{cmdresp}
  49. \cfield{u16} number of \glspl{LED}
  50. \end{cmdresp} \\
  51. \end{cmdlist}