nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches

◆ hid_eventq_keypress_enqueue()

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.

Parameters
[in]qHID event queue object.
[in]idID of the enqueued key.
[in]pressedInformation if the key was pressed or released.
[in]drop_oldestDrop the oldest HID events to make space for the new one.
Return values
0when successful.
-ENOBUFSif reached limit of enqueued HID events.
-ENOMEMif internal memory allocation failed.