1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="Microsoft FrontPage 5.0">
7<META http-equiv="Content-Style-Type" content="text/css">
8<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
9<title>KBDSetLeds</title>
10</head>
11
12<body>
13
14<h1>KBDSetLeds</h1>
15
16
17<h2>Syntax</h2>
18
19<dl>
20<dd><pre><code>#include &lt;revolution/kbd.h&gt;</code></pre>
21  </dd>
22<dd><pre><code>KBDEc KBDSetLeds (KBDChannel ch, KBDLedState leds);</code></pre>
23  </dd>
24</dl>
25
26<h2>Arguments</h2>
27
28<TABLE border="1" cellpadding="3" cellspacing="0.1">
29  <tr>
30<TD width="120" bgcolor="#ffffe8"><code><em><strong>ch</strong></em></code></TD>
31<TD width="520">Keyboard channel to set.</TD>
32    </tr>
33  <tr>
34<TD width="120" bgcolor="#ffffe8"><code><em><strong>leds</strong></em></code></TD>
35<TD width="520">New <code>KBDLedState</code> to send to the keyboard.</TD>
36    </tr>
37</TABLE>
38
39<h2>Return Values</h2>
40
41<TABLE border="1" cellpadding="3" cellspacing="0.1">
42  <tr>
43<TD width="120" bgcolor="#ffffe8"><code><em><strong>KBDEc</strong></em></code></TD>
44<TD width="520">Keyboard error code.<br><code>KBD_SUCCESS</code> if the call was successful.<br> <code>KBD_ERR_NOT_INITIALIZED</code> if the library was not initialized.<br> <code>KBD_ERR_BAD_VALUE</code> if <code>ch</code> or <code>leds</code> is out of range.<br><code>KBD_ERR_BUSY</code> if unable to send a LED command to the keyboard.
45</TD>
46    </tr>
47</TABLE>
48
49<h2>Description</h2>
50
51<p>Sends a LED command to the keyboard on channel <SPAN class="argument">ch</SPAN>. The command tells the keyboard to turn on the LEDs specified by <SPAN class="argument">leds</SPAN>.</p>
52<p><code>KBDSetLeds</code> 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 <a href="KBDSetLedsAsync.html"><code>KBDSetLedsAsync</code></a> or <a href="KBDSetLedsRetry.html"><code>KBDSetLedsRetry</code></a> instead.</p>
53<p>Because this function sends a message over the USB bus, avoid calling it too frequently; this will prevent flooding of the USB bus. Avoid sending more than 12 LED commands (total for all keyboards) per 1/60 second. Even this amount is excessive and should be avoided.</p>
54<p>This function call may fail due to other traffic on the USB bus. If it returns <code>KBD_ERR_BUSY</code>, 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.</p>
55<p>This function will always attempt to send the LED command. Any &quot;lazy&quot; setting of a LED state must be done at a higher level.
56<p>We recommend <code>KBDSetLedsAsync</code>, because <code>KBDSetLeds</code> will block if the keyboard's ACK fails on the USB bus.
57</p>
58<h2>See Also</h2>
59
60<p><a href="list.html">Keyboard Functions</a><BR><a href="KBDSetLedsAsync.html"><code>KBDSetLedsAsync</code></a><BR><a href="KBDSetLedsRetry.html"><code>KBDSetLedsRetry</code></a></p>
61
62<h2>Revision History</h2><p></p>
63
64<P>
652007/10/03 Added a precaution about keyboard ACK.<br>2007/03/19 Initial version 0.1.</p>
66
67<hr>
68
69<hr><p>CONFIDENTIAL</p></body>
70</HTML>
71