Function key module

The Function key module applies the Fn key modifier to activate special functions assigned to dual-purpose keys.

Note

This module is part of the full nRF Desktop design, but none of the reference board configurations currently maintained in the repository enable it. The module remains in the codebase and you can enable it using a Kconfig option in a custom configuration.

Module events

Source Module

Input Event

This Module

Output Event

Sink Module

Buttons module

button_event

fn_keys

Button simulator module

Function key module

Source modules for module_state_event

module_state_event

button_event

Sink modules for button_event

module_state_event

Sink modules for module_state_event

Note

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

Configuration

The module uses button_event sent by CAF: Buttons module. Make sure mentioned CAF module is enabled.

The module is enabled with CONFIG_DESKTOP_FN_KEYS_ENABLE option.

You must configure the following options:

In the file fn_keys_def.h, define all the dual-purpose keys. The fn_keys array must be sorted by key ID (the module uses binary search).

By default, the module subscribes for button_event as the first subscriber (APP_EVENT_SUBSCRIBE_FIRST). You can disable the CONFIG_DESKTOP_FN_KEYS_BUTTON_EVENT_SUBSCRIBE_FIRST Kconfig option to use early subscription (APP_EVENT_SUBSCRIBE_EARLY).

Implementation details

The module replaces the key ID for the dual-purpose keys when the Fn modifier is active (that is, when the Fn key is pressed or the Fn lock is active, but not both). The original button_event is consumed and the new event of the same type is submitted, but with remapped button_event.key_id.