Functions for detecting hardware-specific key combinations.
More...
|
typedef void(* | key_combo_handler_t )(void *p_context) |
| Definition for key combination triggered callback.
|
|
Functions for detecting hardware-specific key combinations.
#define KEY_COMBO_MEMBER_REGISTER |
( |
|
_key_id | ) |
|
Value:NRF_SECTION_ITEM_REGISTER(combo_member_keys,
static const key_combo_member_t CONCAT_2(_COMBO_MEMBER, __LINE__)) = \
{.key_id = _key_id}
Macro for registering key to use in subsequent combo definitions.
Key ID follows format = 0xRowColumn. E.g. 0x14 = key on row 1, column 4.
- Note
- Maximum 32 keys can be registered for use in key combos
- Parameters
-
[in] | _key_id | ID of key that will be used in one or more key combos. |
#define KEY_COMBO_ONE_KEY_REGISTER |
( |
|
key_id_1, |
|
|
|
duration_ms, |
|
|
|
evt_handler |
|
) |
| |
Value:NRF_SECTION_ITEM_REGISTER(combo_descriptions,
static const key_combo_desc_t CONCAT_2(evt_handler, _combo_cb)) = \
{ \
.handler = evt_handler, \
.combo_keys = {key_id_1, 0xFF, 0xFF, 0xFF}, \
.combo_num_keys = 1, \
.combo_duration_ms = duration_ms \
}
Macro for registering one-key combo handler.
- Parameters
-
[in] | key_id_1 | First key ID in key combo |
[in] | duration_ms | Duration in milliseconds that the combo keys must be pressed to trigger the combo |
[in] | evt_handler | Event handler to call when combo is triggered |
#define KEY_COMBO_THREE_KEY_REGISTER |
( |
|
key_id_1, |
|
|
|
key_id_2, |
|
|
|
key_id_3, |
|
|
|
duration_ms, |
|
|
|
evt_handler |
|
) |
| |
Value:NRF_SECTION_ITEM_REGISTER(combo_descriptions,
static const key_combo_desc_t CONCAT_2(evt_handler, _combo_cb)) = \
{ \
.handler = evt_handler, \
.combo_keys = {key_id_1, key_id_2, key_id_3, 0xFF}, \
.combo_num_keys = 3, \
.combo_duration_ms = duration_ms \
}
Macro for registering three-key combo handler.
- Parameters
-
[in] | key_id_1 | First key ID in key combo |
[in] | key_id_2 | Second key ID in key combo |
[in] | key_id_3 | Third key ID in key combo |
[in] | duration_ms | Duration in milliseconds that the combo keys must be pressed to trigger the combo |
[in] | evt_handler | Event handler to call when combo is triggered |
#define KEY_COMBO_TWO_KEY_REGISTER |
( |
|
key_id_1, |
|
|
|
key_id_2, |
|
|
|
duration_ms, |
|
|
|
evt_handler |
|
) |
| |
Value:NRF_SECTION_ITEM_REGISTER(combo_descriptions,
static const key_combo_desc_t CONCAT_2(evt_handler, _combo_cb)) = \
{ \
.handler = evt_handler, \
.combo_keys = {key_id_1, key_id_2, 0xFF, 0xFF}, \
.combo_num_keys = 2, \
.combo_duration_ms = duration_ms \
}
Macro for registering two-key combo handler.
- Parameters
-
[in] | key_id_1 | First key ID in key combo |
[in] | key_id_2 | Second key ID in key combo. |
[in] | duration_ms | Duration in milliseconds that the combo keys must be pressed to trigger the combo |
[in] | evt_handler | Event handler to call when combo is triggered |
ret_code_t key_combo_util_init |
( |
void |
| ) |
|
Key combo detection utility initialization.
- Returns
- NRF_SUCCESS on success, otherwise an error code.
bool key_combo_util_key_process |
( |
const event_t * |
p_event | ) |
|
Event bus event handler.
- Parameters
-
[in] | p_event | Pointer to the event structure. |
- Returns
- True if further processing of the given event should be abandoned.