CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
Addressable pixel strip

WS2811/WS2812/WS2813/SK6812 strip via RMT. More...

Macros

#define PIXEL_FORMAT_GRB   0 /* WS2812/WS2813/SK6812 */
#define PIXEL_FORMAT_RGB   1
#define PIXEL_FORMAT_GRBW   2 /* SK6812 RGBW (white byte = 0 for plugin-side use) */
#define PIXEL_FORMAT_RGBW   3

Functions

int host_pixel_strip_init (uint8_t gpio_pin, uint16_t num_pixels, uint8_t format)
 Initialise or reconfigure the global pixel strip.
int host_pixel_strip_deinit (void)
 Tear down the global pixel strip.
int host_pixel_strip_set (uint16_t index, uint8_t r, uint8_t g, uint8_t b)
 Set one pixel's RGB colour in the strip buffer.
int host_pixel_strip_fill (uint8_t r, uint8_t g, uint8_t b)
 Fill every pixel with the same RGB colour.
int host_pixel_strip_clear (void)
 Clear every pixel to off (0, 0, 0).
int host_pixel_strip_refresh (void)
 Push the strip buffer out over the RMT bus.
uint16_t host_pixel_strip_length (void)
 Number of pixels the strip was initialised with.
bool host_pixel_strip_ready (void)
 True when the strip has been successfully initialised.

Detailed Description

WS2811/WS2812/WS2813/SK6812 strip via RMT.

The host owns one global strip handle keyed to the (gpio_pin, num_pixels, format) tuple given to the first successful init. Re-init with the same tuple is a no-op; with a different tuple the previous handle is replaced. Requires manifest capability "pixel_strip".

Macro Definition Documentation

◆ PIXEL_FORMAT_GRB

#define PIXEL_FORMAT_GRB   0 /* WS2812/WS2813/SK6812 */

Definition at line 1553 of file host_api.h.

◆ PIXEL_FORMAT_GRBW

#define PIXEL_FORMAT_GRBW   2 /* SK6812 RGBW (white byte = 0 for plugin-side use) */

Definition at line 1555 of file host_api.h.

◆ PIXEL_FORMAT_RGB

#define PIXEL_FORMAT_RGB   1

Definition at line 1554 of file host_api.h.

◆ PIXEL_FORMAT_RGBW

#define PIXEL_FORMAT_RGBW   3

Definition at line 1556 of file host_api.h.

Function Documentation

◆ host_pixel_strip_clear()

int host_pixel_strip_clear ( void )

Clear every pixel to off (0, 0, 0).

Definition at line 159 of file host_api_pixel_strip.cpp.

References HOST_ERR_BUSY, HOST_ERR_GENERIC, HOST_ERR_NO_CAPABILITY, HOST_OK, and mutex.

Referenced by cdc::plugin_manager::w_host_pixel_strip_clear().

◆ host_pixel_strip_deinit()

int host_pixel_strip_deinit ( void )

Tear down the global pixel strip.

Definition at line 128 of file host_api_pixel_strip.cpp.

References HOST_ERR_BUSY, HOST_ERR_NO_CAPABILITY, HOST_OK, and mutex.

Referenced by cdc::plugin_manager::w_host_pixel_strip_deinit().

◆ host_pixel_strip_fill()

int host_pixel_strip_fill ( uint8_t r,
uint8_t g,
uint8_t b )

Fill every pixel with the same RGB colour.

Definition at line 147 of file host_api_pixel_strip.cpp.

References HOST_ERR_BUSY, HOST_ERR_GENERIC, HOST_ERR_NO_CAPABILITY, HOST_OK, and mutex.

Referenced by cdc::plugin_manager::w_host_pixel_strip_fill().

◆ host_pixel_strip_init()

int host_pixel_strip_init ( uint8_t gpio_pin,
uint16_t num_pixels,
uint8_t format )

Initialise or reconfigure the global pixel strip.

Definition at line 110 of file host_api_pixel_strip.cpp.

References HOST_ERR_BUSY, HOST_ERR_INVALID_ARG, HOST_ERR_NO_CAPABILITY, HOST_OK, cdc::plugin_manager::gpio_policy::isAllowed(), and mutex.

Referenced by cdc::plugin_manager::w_host_pixel_strip_init().

◆ host_pixel_strip_length()

uint16_t host_pixel_strip_length ( void )

Number of pixels the strip was initialised with.

Definition at line 177 of file host_api_pixel_strip.cpp.

References mutex.

Referenced by cdc::plugin_manager::w_host_pixel_strip_length().

◆ host_pixel_strip_ready()

bool host_pixel_strip_ready ( void )

True when the strip has been successfully initialised.

Definition at line 184 of file host_api_pixel_strip.cpp.

References mutex.

Referenced by cdc::plugin_manager::w_host_pixel_strip_ready().

◆ host_pixel_strip_refresh()

int host_pixel_strip_refresh ( void )

Push the strip buffer out over the RMT bus.

Definition at line 168 of file host_api_pixel_strip.cpp.

References HOST_ERR_BUSY, HOST_ERR_GENERIC, HOST_ERR_NO_CAPABILITY, HOST_OK, and mutex.

Referenced by cdc::plugin_manager::w_host_pixel_strip_refresh().

◆ host_pixel_strip_set()

int host_pixel_strip_set ( uint16_t index,
uint8_t r,
uint8_t g,
uint8_t b )

Set one pixel's RGB colour in the strip buffer.

Definition at line 137 of file host_api_pixel_strip.cpp.

References HOST_ERR_BUSY, HOST_ERR_GENERIC, HOST_ERR_INVALID_ARG, HOST_ERR_NO_CAPABILITY, HOST_OK, and mutex.

Referenced by cdc::plugin_manager::w_host_pixel_strip_set().