#include <cafe/kbd.h>

KBDEc KBDGetKey(KBDChannel ch, KBDKeyEvent *keyEvent);


ch Keyboard channel to query.
keyEvent Pointer to the KBDKeyEvent structure. Stores the key event at the head of the KBD library's internal key queue.

Return Values

KBDEc Keyboard error code.
KBD_SUCCESS if the call was successful.
KBD_ERR_NOT_INITIALIZED if the library was not initialized.
KBD_ERR_BAD_VALUE if ch was out of range.
KBD_ERR_BAD_STATUS if the keyboard on channel ch is disconnected.


Synchronous API to get key events. Returns key event data from an internal key queue maintained within the KBD library. The key event data are written to the structure pointed to by keyEvent.

If the key HID value is KBD_HID_NONE, no key was pressed since the previous call to this function. If the HID value is KBD_HID_OVERFLOW, the queue has overflowed.

Each keyboard channel has its own key queue.

For more information about the key event structure, refer to KBDKeyEvent.

Do Not Call From

Background Do not call this function from the background.
Multiple threads This function, while thread-safe, is designed to be called from only a single thread.

See Also


Revision History

2013-05-08 Automated cleanup pass.
2013-01-13 Removed KBD_ERR_BAD_POINTER.
2011-12-21 Moved to Cafe.
2007-03-27 Initial version.