#include <cafe/kbd.h>

KBDEc KBDSetLedsRetryEx (KBDChannel ch, KBDLedState leds);


ch Keyboard channel to set.
leds New KBDLedState to send to the keyboard.

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 or leds is out of range.


Sends an LED command to the keyboard on channel ch. The command instructs the keyboard to turn on the LEDs specified by leds. If the attempt fails due to the KBD_ERR_BUSY condition, a timer is set to retry the call 1 millisecond later. This will continue until a retry succeeds, or until another error status occurs.

KBDSetLedsRetryEx is a non-blocking call, and it may be used from within a callback or whenever interrupts are disabled. This is in contrast to the blocking version of this function, KBDSetLedsEx.

Because KBDSetLedsRetryEx sends a message over the USB bus, refrain from calling this API too frequently to prevent flooding of the USB bus. Avoid sending more than 12 LED commands (total for all keyboards) per 1/60th of a second. Even this amount is excessive and should be avoided.

This function will always attempt to send the LED command. Any "lazy" setting of LED state must be performed at a higher level.

Do Not Call From

Background Do not call this function from the background.

See Also


Revision History

2013/06/20 Initial version.