Loading...
Searching...
No Matches
ws281x_params.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 Marian Buschsieweke
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include <limits.h>
19
20#include "board.h"
21#include "saul_reg.h"
22
23#include "ws281x.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
33#ifndef WS281X_PARAM_PIN
34# define WS281X_PARAM_PIN (GPIO_PIN(0, 0))
35#endif
36#ifndef WS281X_PARAM_NUMOF
37# define WS281X_PARAM_NUMOF (8U)
38#endif
39#ifndef WS281X_PARAM_BUF
44# define WS281X_PARAM_BUF (ws281x_buf)
45#endif
46
47#ifndef WS281X_PARAMS
51# define WS281X_PARAMS { \
52 .pin = WS281X_PARAM_PIN, \
53 .numof = WS281X_PARAM_NUMOF, \
54 .buf = WS281X_PARAM_BUF, \
55 }
56#endif
58
63{
65};
66
71
78#ifndef WS281X_T_DATA_NS
79# define WS281X_T_DATA_NS (1250U)
80#endif
81
85#ifndef WS281X_T_DATA_ONE_NS
86# define WS281X_T_DATA_ONE_NS (650U)
87#endif
88
92#ifndef WS281X_T_DATA_ZERO_NS
93# define WS281X_T_DATA_ZERO_NS (325U)
94#endif
95
102#ifndef WS281X_T_END_US
103# define WS281X_T_END_US (80U)
104#endif
106
126#if !defined(WS281X_TIMER_DEV) || defined(DOXYGEN)
127# define WS281X_TIMER_DEV TIMER_DEV(2)
128#endif
129
134#ifndef WS281X_TIMER_MAX_VALUE
135# define WS281X_TIMER_MAX_VALUE UINT_MAX
136#endif
137
143#ifndef WS281X_TIMER_FREQ
144# define WS281X_TIMER_FREQ 16000000
145#endif
146
152#ifndef WS281X_SPI_DEV
153# define WS281X_SPI_DEV SPI_DEV(0)
154#endif
155
161#ifndef WS281X_SPI_CLK
162# define WS281X_SPI_CLK 3200000
163#endif
164
168#ifndef WS281X_SAUL_INFO
169# define WS281X_SAUL_INFO { .name = "WS281X RGB LED" }
170#endif
171
176{
178};
179
180#ifdef __cplusplus
181}
182#endif
183
#define WS281X_PARAM_NUMOF
Number of LEDs chained.
Definition board.h:74
#define WS281X_BYTES_PER_DEVICE
The number of bytes to allocate in the data buffer per LED.
Definition ws281x.h:100
SAUL registry interface definition.
Additional data to collect for each entry.
Definition saul_reg.h:48
Struct to hold initialization parameters for a WS281x RGB LED.
Definition ws281x.h:115
WS2812/SK6812 RGB LED Driver.
#define WS281X_SAUL_INFO
SAUL info.
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.
uint8_t ws281x_buf[WS281X_PARAM_NUMOF *WS281X_BYTES_PER_DEVICE]
Data buffer holding the LED states.
#define WS281X_PARAMS
WS281x initialization parameters.