Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
led.h File Reference

Public LED driver APIs. More...

#include <errno.h>
#include <zephyr/types.h>
#include <zephyr/device.h>
#include <zephyr/syscalls/led.h>

Go to the source code of this file.

Data Structures

struct  led_info
 LED information structure. More...
 
struct  led_driver_api
 LED driver API. More...
 
struct  led_dt_spec
 Container for an LED information specified in devicetree. More...
 

Macros

#define LED_DT_SPEC_GET(node_id)
 Static initializer for a struct led_dt_spec.
 
#define LED_DT_SPEC_GET_OR(node_id, default_value)
 Like LED_DT_SPEC_GET(), with a fallback value if the node does not exist.
 

Typedefs

typedef int(* led_api_blink) (const struct device *dev, uint32_t led, uint32_t delay_on, uint32_t delay_off)
 Callback API for blinking an LED.
 
typedef int(* led_api_get_info) (const struct device *dev, uint32_t led, const struct led_info **info)
 Optional API callback to get LED information.
 
typedef int(* led_api_set_brightness) (const struct device *dev, uint32_t led, uint8_t value)
 Callback API for setting brightness of an LED.
 
typedef int(* led_api_set_color) (const struct device *dev, uint32_t led, uint8_t num_colors, const uint8_t *color)
 Optional API callback to set the colors of a LED.
 
typedef int(* led_api_on) (const struct device *dev, uint32_t led)
 Callback API for turning on an LED.
 
typedef int(* led_api_off) (const struct device *dev, uint32_t led)
 Callback API for turning off an LED.
 
typedef int(* led_api_write_channels) (const struct device *dev, uint32_t start_channel, uint32_t num_channels, const uint8_t *buf)
 Callback API for writing a strip of LED channels.
 

Functions

int led_blink (const struct device *dev, uint32_t led, uint32_t delay_on, uint32_t delay_off)
 Blink an LED.
 
int led_get_info (const struct device *dev, uint32_t led, const struct led_info **info)
 Get LED information.
 
int led_set_brightness (const struct device *dev, uint32_t led, uint8_t value)
 Set LED brightness.
 
int led_write_channels (const struct device *dev, uint32_t start_channel, uint32_t num_channels, const uint8_t *buf)
 Write/update a strip of LED channels.
 
int led_set_channel (const struct device *dev, uint32_t channel, uint8_t value)
 Set a single LED channel.
 
int led_set_color (const struct device *dev, uint32_t led, uint8_t num_colors, const uint8_t *color)
 Set LED color.
 
int led_on (const struct device *dev, uint32_t led)
 Turn on an LED.
 
int led_off (const struct device *dev, uint32_t led)
 Turn off an LED.
 
static int led_set_brightness_dt (const struct led_dt_spec *spec, uint8_t value)
 Set LED brightness from a led_dt_spec.
 
static int led_on_dt (const struct led_dt_spec *spec)
 Turn on an LED from a struct led_dt_spec.
 
static int led_off_dt (const struct led_dt_spec *spec)
 Turn off an LED from a struct led_dt_spec.
 
static bool led_is_ready_dt (const struct led_dt_spec *spec)
 Validate that the LED device is ready.
 

Detailed Description

Public LED driver APIs.