PixelKey
NeoPixel USB Key
Loading...
Searching...
No Matches
NeoPixel

Support for NeoPixel LEDs. More...

Data Structures

struct  neopixel_data_t
 Individual data block for a NeoPixel: 24-bit color green-red-blue sent MSb first. More...
 

Macros

#define NEOPIXEL_CHANNEL_COUNT   (3U)
 Number of color channels per neopixel.
 
#define NEOPIXEL_COLOR_BITS   (NEOPIXEL_CHANNEL_COUNT * 8U)
 Total number of bits for a single NeoPixel.
 
#define NEOPIXEL_CODE_T0H_NS   (300U)
 Period of the 0-NRZ-code high assertion time, in nanoseconds.
 
#define NEOPIXEL_CODE_T0L_NS   (900U)
 Period of the 0-NRZ-code low assertion time, in nanoseconds.
 
#define NEOPIXEL_CODE_T1H_NS   (600U)
 Period of the 1-NRZ-code high assertion time, in nanoseconds.
 
#define NEOPIXEL_CODE_T1L_NS   (600U)
 Period of the 1-NRZ-code low assertion time, in nanoseconds.
 
#define NEOPIXEL_CODE_TBIT_NS   (1200U)
 Total period, in nanoseconds, for the high and low portions of the NRZ bit codes.
 
#define NEOPIXEL_CODE_TRST_NS   (80000U)
 Minumum period, in nanoseconds, of the reset code.
 
#define NEOPIXEL_GAMMA_CORRECTION_DEFAULT   (2.8f)
 Default gamma correction factor for NeoPixels. More...
 

Detailed Description

Support for NeoPixel LEDs.

NeoPixel Timing Requirements

Data codes

NeoPixels use a NRZ (non-return-to-zero) code with a fixed timing width to transmit color data.

Code | Timing waveform
------ | ----------------------------------------------------------------------
| |<------- 1.20 us ----->| (Nominal 1.25±0.6 us ≈ 800 kHz)
| _______
0 | XXX| |________________XXX
| |<-T0H->|<- TOL ->|
| (0.3) (0.9) us (25% duty-cycle)
|
| ___________
1 | XXX| |____________XXX
| |<- T1H ->|<- T1L ->|
| (0.6) (0.6) us (50% duty-cycle)
|
RST | XXX_____________________________________XXX
| |<- TRST ->|
| (80) us

Data transmission

Data is transmitted during each refresh cycle. All NeoPixels color codes are transmitted in sequence followed by a reset code. Each subsequent NeoPixel re-transmits any bit codes that follow after reception of its data.

NeoPixel | Data | Reset | Data | Reset
--------- | ----------------------------------- | ------- | ---------------------------------- | --------
| | | |
| <--------------- Data frame 1 --------------->|<--------------- Data frame 2 --------------->
| Data1 Data2 Data3 | | Data1 Data2 Data3 |
D1 |_<̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_><̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_><̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_>____//____<̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_><̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_><̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_>____//____
| <G1><R1><B1><G2><R2><B2><G3><R3><B3>| |<G1><R1><B1><G2><R2><B2><G3><R3><B3>|
D2 |_____________<̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_><̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_>____//_________________<̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_><̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_>____//____
| <G2><R2><B2><G3><R3><B3>| | <G2><R2><B2><G3><R3><B3>|
D3 |_________________________<̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_>____//_____________________________<̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_̅_>____//____
| <G3><R3><B3>| | <G3><R3><B3>|
D4 |_________________________________________//_____________________________________________//____
| | | |

Macro Definition Documentation

◆ NEOPIXEL_GAMMA_CORRECTION_DEFAULT

#define NEOPIXEL_GAMMA_CORRECTION_DEFAULT   (2.8f)

Default gamma correction factor for NeoPixels.

From: https://learn.adafruit.com/led-tricks-gamma-correction/the-longer-fix.