LED stream module

Use the LED stream module to receive the LED effect sequence and display it using LEDs. The LED effect sequence is generated on the host computer and sent through the Configuration channel.

Module events

Source Module

Input Event

This Module

Output Event

Sink Module

Source modules for config_event



HID state module


LED state module

LED stream module

LEDs module


Source modules for module_state_event



Sink modules for config_event


LED stream module

LEDs module


Sink modules for module_state_event


See the Application overview for more information about the event-based communication in the nRF Desktop application and about how to read this table.


The module receives LED effects through the Configuration channel and displays them using the CAF: LEDs module. For this reason, make sure that both CONFIG_CAF_LEDS and CONFIG_DESKTOP_CONFIG_CHANNEL_ENABLE options are set.

To enable the module, use the CONFIG_DESKTOP_LED_STREAM_ENABLE Kconfig option.

You can also define the stream LED event queue size using CONFIG_DESKTOP_LED_STREAM_QUEUE_SIZE option. The queue is used by the module as a data buffer for the data received from the host computer.

Configuration channel


All the described Configuration channel options are used by the HID configurator for nRF Desktop during the led_stream operation. You can trigger displaying the LED stream effects using the led_stream command in CLI.

The module is a Configuration channel listener and provides the following options:

  • set_led_effect

    The HID configurator for nRF Desktop performs the set operation on this option to send the LED effect step that will be displayed by the CAF: LEDs module. The selected LED is identified using the LED ID provided in the data received from the host. The module queues the received LED effect steps and forwards them to CAF: LEDs module one after another. See the CAF: LEDs module documentation for more detailed information about the LED effect and LED effect step.

  • get_leds_state

    The HID configurator for nRF Desktop performs the fetch operation on this option to get the number of available free places in the queue of LED effect steps for every LED. This information can be used, for example, to synchronize the displayed LED effects with music.

    Fetching this option also provides information whether the CAF: LEDs module is ready. If the device is suspended by Power manager module, the LEDs are turned off and the effects cannot be displayed. You then must wake up the device before displaying the LED stream.

Implementation details

The module receives LED effects as config_event. The effects are sent to CAF: LEDs module as led_event. Displaying the sequence begins when the first LED effect is received by the LED stream module.

Every received LED effect has a predefined duration. The LEDs module submits led_ready_event when it finishes displaying a LED effect. On this event, the LED stream module sends the next effect from the queue.

When the sequence is active, the host computer keeps sending new effects that are queued by the LED stream module. The sequence ends when there are no more effects available in the queue.

LED state interaction

The LED state module uses LEDs to display both the state of the system and the state of the connected Bluetooth® peer. The LED stream module takes control over the selected LED only when the sequence is displayed. After the sequence ends, the LED effect selected by the LED state module is restored.