#include <revolution/kbd.h>
KBDEc KBDSetLeds (KBDChannel ch, KBDLedState leds);
ch |
Keyboard channel to set. |
leds |
New KBDLedState to send to the keyboard. |
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.KBD_ERR_BUSY if unable to send an LED command to the keyboard.
|
Sends an LED command to the keyboard on channel ch. The command tells the keyboard to turn on the LEDs specified by leds.
KBDSetLeds is a blocking call, and it cannot be used from within a callback or whenever interrupts are disabled. To set the LEDs when interrupts are disabled, use KBDSetLedsAsync or KBDSetLedsRetry instead.
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 call may fail due to other traffic on the USB bus. If it returns KBD_ERR_BUSY, the LED command was not sent. In this case you must call it again. Because you want the traffic to die down before trying again, you should have a delay between attempts.
This function will always attempt to send the LED command. Any "lazy" setting of LED state must be done at a higher level.
Keyboard Functions, KBDSetLedsAsync, KBDSetLedsRetry
2007/03/19 Initial version.