Default configuration for WS2812/SK6812 RGB LEDs. More...
Default configuration for WS2812/SK6812 RGB LEDs.
Definition in file ws281x_params.h.
Include dependency graph for ws281x_params.h:Go to the source code of this file.
Macros | |
| #define | WS281X_TIMER_DEV TIMER_DEV(2) |
| Timer used for WS281x (by the timer_gpio_ll implementation) | |
| #define | WS281X_TIMER_MAX_VALUE UINT_MAX |
| Maximum value of the timer used for WS281x (by the timer_gpio_ll implementation) | |
| #define | WS281X_TIMER_FREQ 16000000 |
| Frequency for the timer used for WS281x (by the timer_gpio_ll implementation) | |
| #define | WS281X_SPI_DEV SPI_DEV(0) |
| SPI device to use for WS281x RGB LED data transmission. | |
| #define | WS281X_SPI_CLK 3200000 |
| SPI clock speed: 3.2 MHz → 312.5 ns per SPI bit. | |
| #define | WS281X_SAUL_INFO { .name = "WS281X RGB LED" } |
| SAUL info. | |
Variables | |
| static const ws281x_params_t | ws281x_params [] |
| Initialization parameters for WS281x devices. | |
| static const saul_reg_info_t | ws281x_saul_info [] |
| Additional meta information to keep in the SAUL registry. | |
Default configuration parameters for WS281x RGB LEDs | |
| #define | WS281X_PARAM_PIN (GPIO_PIN(0, 0)) |
| GPIO pin connected to the data pin of the first LED. | |
| #define | WS281X_PARAM_NUMOF (8U) |
| Number of LEDs chained. | |
| #define | WS281X_PARAM_BUF (ws281x_buf) |
| Data buffer holding LED states. | |
| #define | WS281X_PARAMS |
| WS281x initialization parameters. | |
| uint8_t | ws281x_buf [WS281X_PARAM_NUMOF *WS281X_BYTES_PER_DEVICE] |
| Data buffer holding the LED states. | |
Timing parameters for WS2812/SK6812 RGB LEDs | |
| #define | WS281X_T_DATA_NS (1250U) |
| Data transmission time in nanoseconds. | |
| #define | WS281X_T_DATA_ONE_NS (650U) |
| The high-time of a 1 in nanoseconds. | |
| #define | WS281X_T_DATA_ZERO_NS (325U) |
| The high-time of a 0 in nanoseconds. | |
| #define | WS281X_T_END_US (80U) |
| Time in microseconds to pull the data line low to signal end of data. | |
| #define WS281X_PARAM_BUF (ws281x_buf) |
Data buffer holding LED states.
Definition at line 44 of file ws281x_params.h.
| #define WS281X_PARAM_NUMOF (8U) |
Number of LEDs chained.
Definition at line 37 of file ws281x_params.h.
| #define WS281X_PARAM_PIN (GPIO_PIN(0, 0)) |
GPIO pin connected to the data pin of the first LED.
Definition at line 34 of file ws281x_params.h.
| #define WS281X_PARAMS |
WS281x initialization parameters.
Definition at line 51 of file ws281x_params.h.
| #define WS281X_SAUL_INFO { .name = "WS281X RGB LED" } |
SAUL info.
Definition at line 169 of file ws281x_params.h.
| #define WS281X_SPI_CLK 3200000 |
SPI clock speed: 3.2 MHz → 312.5 ns per SPI bit.
4 SPI bits add up to 1.25 µs period, which is the time to transmit one WS281x bit.
Definition at line 162 of file ws281x_params.h.
| #define WS281X_SPI_DEV SPI_DEV(0) |
SPI device to use for WS281x RGB LED data transmission.
This SPI must support DMA.
Definition at line 153 of file ws281x_params.h.
| #define WS281X_T_DATA_NS (1250U) |
Data transmission time in nanoseconds.
For the SK6812, WS2812 and WS2812b this is 1.25 µs. This is the total time required to transmit one bit.
Definition at line 79 of file ws281x_params.h.
| #define WS281X_T_DATA_ONE_NS (650U) |
The high-time of a 1 in nanoseconds.
Definition at line 86 of file ws281x_params.h.
| #define WS281X_T_DATA_ZERO_NS (325U) |
The high-time of a 0 in nanoseconds.
Definition at line 93 of file ws281x_params.h.
| #define WS281X_T_END_US (80U) |
Time in microseconds to pull the data line low to signal end of data.
For the WS2812 it is ≥ 50µs, for the SK6812 it is ≥ 80µs. We choose 80µs to be compatible with both.
Definition at line 103 of file ws281x_params.h.
| #define WS281X_TIMER_DEV TIMER_DEV(2) |
Timer used for WS281x (by the timer_gpio_ll implementation)
A single timer is configured for any number of WS281x strands, so this does not need to be part of params.
It is required that the timer has at least 2 channels. (Future versions may require a 3rd channel).
It is required that the timer's MAX_VALUE is 2^n-1, which is a trivial but not explicitly stated case.
This timer is configured at WS281x initialization time, and kept stopped outside of transmissions.
The default value of 2 is chosen because the only platform on which the module is usable is nRF5x, where TIMER_DEV(1) is in use by the radio module. It is strongly advised to explicitly set this timer to a known free timer, as the default may change without notice.
Definition at line 127 of file ws281x_params.h.
| #define WS281X_TIMER_FREQ 16000000 |
Frequency for the timer used for WS281x (by the timer_gpio_ll implementation)
This should be set to a frequency that is a close multiple of 3MHz, depending on the precise low and high times. A value of 16MHz works well.
Definition at line 144 of file ws281x_params.h.
| #define WS281X_TIMER_MAX_VALUE UINT_MAX |
Maximum value of the timer used for WS281x (by the timer_gpio_ll implementation)
This macro needs to be defined to the maximum value of WS281X_TIMER_DEV.
Definition at line 135 of file ws281x_params.h.
|
static |
Initialization parameters for WS281x devices.
Definition at line 62 of file ws281x_params.h.
|
static |
Additional meta information to keep in the SAUL registry.
Definition at line 175 of file ws281x_params.h.