KBDSetLedsRetry

C Specification

#include <revolution/kbd.h>
KBDEc KBDSetLedsRetry (KBDChannel ch, KBDLedState leds);

Arguments

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 is returned if the library is not initialized.
KBD_ERR_BAD_VALUE is returned if ch or leds are out of range.

Description

Sends an LED command to the keyboard on channel ch. The command tells the keyboard to turn on the LEDs specified by leds. If this instruction fails with KBD_ERR_BUSY, a timer is set to perform a retry (after one millisecond). This will continue until a retry succeeds, or until another error status occurs.

KBDSetLedsRetry 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, KBDSetLeds.

Since KBDSetLedsRetry sends a message over the USB bus, you should avoid calling this function too frequently (to avoid flooding the USB bus). You should avoid sending more than 12 LED commands (total for all keyboards) per 1/60 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 done at a higher level.

See Also

Keyboard Functions, KBDSetLeds, KBDSetLedsAsync

Revision History

2007/03/19 Initial version 0.1.