PebbleOS v4.47.0-888-g9fa910d13
Loading...
Searching...
No Matches
WS2812B

Worldsemi WS2812B RGB LED on a SPI MOSI line. More...

Data Structures

struct  pbl_ws2812b
 WS2812B. More...
 

Macros

#define PBL_WS2812B_DEFINE(sym, _bus, _cs, _max_hz)
 Define a WS2812B.
 

Detailed Description

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.


Data Structure Documentation

◆ pbl_ws2812b

struct pbl_ws2812b

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.

Macro Definition Documentation

◆ PBL_WS2812B_DEFINE

#define PBL_WS2812B_DEFINE (   sym,
  _bus,
  _cs,
  _max_hz 
)
Value:
static struct pbl_ws2812b_state sym##_ws2812b_state; \
PBL_DEVICE_INSTANCE(sym, struct pbl_ws2812b, struct pbl_led, led) { \
.led = PBL_LED_INIT(sym, "ws2812b", pbl_ws2812b_init, &(_bus)->dev, &pbl_ws2812b_ops), \
.spi = PBL_SPI_DEV(_bus, _cs, _max_hz, PBL_SPI_MODE_0), .state = &sym##_ws2812b_state, \
}
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
WS2812B.
Definition ws2812b.h:34
LED.
Definition led.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
symSymbol of the instance.
_busSPI bus.
_csChip select index, an unconnected one.
_max_hzSPI clock, 2.105 MHz to 2.85 MHz.