Function key module
The Function key module applies the Fn key modifier to activate special functions assigned to dual-purpose keys.
Module events
Source Module |
Input Event |
This Module |
Output Event |
Sink Module |
---|---|---|---|---|
|
|
|||
|
||||
|
||||
|
Note
See the Overview: Firmware architecture 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 hardware interface is defined.
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).
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
.