Worldsemi WS2812B RGB LED on a SPI MOSI line.
More...
Worldsemi WS2812B RGB LED on a SPI MOSI line.
Each LED bit is sent as three SPI bits, 100 for a 0 and 110 for a 1, so the SPI clock is between 2.105 MHz and 2.85 MHz, followed by a low line long enough for the LED to latch. The LED is the first of its chain.
◆ pbl_ws2812b
| Data Fields |
|
struct pbl_led |
led |
LED, child of the SPI bus. |
|
struct pbl_spi_dev |
spi |
SPI device. |
|
struct pbl_ws2812b_state * |
state |
Runtime state. |
◆ PBL_WS2812B_DEFINE
| #define PBL_WS2812B_DEFINE |
( |
|
sym, |
|
|
|
_bus, |
|
|
|
_cs, |
|
|
|
_max_hz |
|
) |
| |
Value:
static struct pbl_ws2812b_state sym##_ws2812b_state; \
.led =
PBL_LED_INIT(sym,
"ws2812b", pbl_ws2812b_init, &(_bus)->dev, &pbl_ws2812b_ops), \
}
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
WS2812B.
Definition ws2812b.h:34
#define PBL_LED_INIT(sym, _name, _init, _parent, _ops)
Initialize a struct pbl_led.
Definition led.h:57
#define PBL_SPI_DEV(_bus, _cs, _max_hz, _mode)
Initializer for a struct pbl_spi_dev.
Definition spi.h:173
#define PBL_SPI_MODE_0
Mode 0: clock idles low, sample on the leading edge.
Definition spi.h:62
Define a WS2812B.
- Parameters
-
| sym | Symbol of the instance. |
| _bus | SPI bus. |
| _cs | Chip select index, an unconnected one. |
| _max_hz | SPI clock, 2.105 MHz to 2.85 MHz. |