![]() |
nRF Connect SDK API 3.3.99
|
| int hid_eventq_keypress_enqueue | ( | struct hid_eventq * | q, |
| uint16_t | id, | ||
| bool | pressed, | ||
| bool | drop_oldest ) |
#include <applications/nrf_desktop/src/util/hid_eventq.h>
Enqueue a keypress event in HID event queue.
The function enqueues an event related to key press or release.
If drop oldest is disabled, the function returns an error if it reached a limit of enqueued events. Otherwise, the function tries to remove the oldest keypress events ensuring that an enqueued event related to a key press is not removed if a matching key release event cannot be removed.
| [in] | q | HID event queue object. |
| [in] | id | ID of the enqueued key. |
| [in] | pressed | Information if the key was pressed or released. |
| [in] | drop_oldest | Drop the oldest HID events to make space for the new one. |
| 0 | when successful. |
| -ENOBUFS | if reached limit of enqueued HID events. |
| -ENOMEM | if internal memory allocation failed. |