Zephyr Project API 4.4.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
LED Strip

Interfaces for LED strips. More...

Topics

 Device-specific LED Strip API extensions

Files

file  led_strip.h
 Main header file for LED strip driver API.

Data Structures

struct  led_rgb
 Color value for a single RGB LED. More...
struct  led_strip_driver_api
 @driver_ops{LED Strip} More...

Functions

static int led_strip_update_rgb (const struct device *dev, struct led_rgb *pixels, size_t num_pixels)
 Update an LED strip with the given RGB array.
static int led_strip_update_channels (const struct device *dev, uint8_t *channels, size_t num_channels)
 Update an LED strip with the given channel array.
static size_t led_strip_length (const struct device *dev)
 Get chain length (in pixels) of an LED strip device.
typedef int(* led_api_update_rgb) (const struct device *dev, struct led_rgb *pixels, size_t num_pixels)
 @def_driverbackendgroup{LED Strip,led_strip_interface}
typedef int(* led_api_update_channels) (const struct device *dev, uint8_t *channels, size_t num_channels)
 Callback API for updating channels without an RGB interpretation.
typedef size_t(* led_api_length) (const struct device *dev)
 Callback API for getting length of an LED strip.

Detailed Description

Interfaces for LED strips.

Typedef Documentation

◆ led_api_length

typedef size_t(* led_api_length) (const struct device *dev)

#include <led_strip.h>

Callback API for getting length of an LED strip.

See led_strip_length() for argument descriptions.

◆ led_api_update_channels

typedef int(* led_api_update_channels) (const struct device *dev, uint8_t *channels, size_t num_channels)

#include <led_strip.h>

Callback API for updating channels without an RGB interpretation.

See led_strip_update_channels() for argument descriptions.

◆ led_api_update_rgb

typedef int(* led_api_update_rgb) (const struct device *dev, struct led_rgb *pixels, size_t num_pixels)

#include <led_strip.h>

@def_driverbackendgroup{LED Strip,led_strip_interface}

Callback API for updating an RGB LED strip

See led_strip_update_rgb() for argument descriptions.

Function Documentation

◆ led_strip_length()

size_t led_strip_length ( const struct device * dev)
inlinestatic

#include <led_strip.h>

Get chain length (in pixels) of an LED strip device.

Parameters
devLED strip device.
Returns
Length of LED strip device.

◆ led_strip_update_channels()

int led_strip_update_channels ( const struct device * dev,
uint8_t * channels,
size_t num_channels )
inlinestatic

#include <led_strip.h>

Update an LED strip with the given channel array.

Each channel byte corresponds to an individually addressable color channel or LED. Channels are updated linearly in strip order.

Parameters
devLED strip device.
channelsArray of per-channel data.
num_channelsLength of channels array.
Return values
0on success.
-ENOSYSif not implemented.
-errnonegative errno code on other failure.
Warning
This routine may overwrite channels.

◆ led_strip_update_rgb()

int led_strip_update_rgb ( const struct device * dev,
struct led_rgb * pixels,
size_t num_pixels )
inlinestatic

#include <led_strip.h>

Update an LED strip with the given RGB array.

Parameters
devLED strip device.
pixelsArray of pixel data.
num_pixelsLength of pixels array.
Return values
0on success.
-errnonegative errno code on failure.
Warning
This routine may overwrite pixels.