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 |
|---|---|---|---|---|
|
|
|||
|
||||
|
||||
|
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:
CONFIG_DESKTOP_FN_KEYS_SWITCH- Fn key button.CONFIG_DESKTOP_FN_KEYS_LOCK- Fn lock button.CONFIG_DESKTOP_STORE_FN_LOCK- Option for defining if the device should store the Fn lock state after reboot (set by default to storing the state).CONFIG_DESKTOP_FN_KEYS_MAX_ACTIVE- Maximum number of dual-purpose keys pressed at the same time (8 by default). The module remembers the pressed keys to send proper key releases.
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.