1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 2<HTML> 3<HEAD> 4 <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252"> 5 <TITLE>Keyboard (KBD) Sample Demo</TITLE> 6 <META NAME="GENERATOR" CONTENT="Microsoft FrontPage 5.0"> 7 <META NAME="CREATED" CONTENT="20070320;17165996"> 8 <META NAME="CHANGEDBY" CONTENT="Carl Mueller"> 9 <META NAME="CHANGED" CONTENT="20070320;17255518"> 10<META http-equiv="Content-Style-Type" content="text/css"> 11<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 12</HEAD> 13<BODY LANG="en-US" TEXT="#000000" LINK="#000000" DIR="LTR"> 14<H1>Keyboard (KBD) Sample Demo</H1> 15 16<H2>Location</H2> 17<P><CODE>$REVOLUTION_SDK_ROOT/build/demos/kbddemo</CODE></P> 18 19<H2>Compilation</H2> 20<P>Go to the directory <CODE>$REVOLUTION_SDK_ROOT/build/demos/kbddemo</CODE> and type "make". Executable (<CODE>.elf</CODE>) files will be generated under the path <CODE>$REVOLUTION_SDK_ROOT/RVL/bin/demos/kbddemo/</CODE>.</P> 21 22<H2>Execution</H2> 23<P>To function, all demos require a USB keyboard. A Nintendo GameCube Controller is also required for some demos.</P> 24<P>The demos <CODE>kbdUTF8</CODE> and <CODE>kbdUTF8Sync</CODE> require a UTF-8 compliant terminal program in order to properly view the output for non-English keyboards. This is one method we have found for properly showing the output of these demos:</P> 25<OL><LI>Run Cygwin setup program and under <CODE>devel</CODE> install the Cygwin package "ruby: Interpreted object-oriented scripting language".</LI> 26<LI>Install <CODE>terminator.msi</CODE> from <a href="http://software.jessies.org/terminator/">http://software.jessies.org/terminator/</a>.</LI> 27<LI>Double-click on the <B>Terminator</B> icon on the desktop.</LI> 28<LI>Exit all serial terminal programs that had been running.</LI> 29<LI>In the <B>Terminator</B> window, run "uterm com<STRONG>X</STRONG>". Here, <STRONG>X</STRONG> is the number of the serial out COM port of the NDEV you are using. <CODE>Uterm</CODE> is in <CODE>$REVOLUTION_SDK_ROOT/X86/bin/</CODE >.</LI> 30<LI>Running the <CODE>kbdUTF8</CODE> demo.</LI> 31<LI>(To exit <CODE>Uterm</CODE>, enter CTRL+C on the PC.))</LI> 32</OL> 33<P>To run either of the demos, change to the <CODE>$REVOLUTION_SDK_ROOT/RVL/bin/demos/kbddemo/</CODE> directory and do the following:</P> 34<UL> 35 <LI><P STYLE="margin-bottom: 0in">To simply run an application, run the <CODE>ndrun</CODE> script with the <CODE>.elf</CODE> file as an argument. 36 </P> 37 <LI><P STYLE="margin-bottom: 0in">To debug using CodeWarrior, do one of the following: 38 </P> 39 <UL> 40 <LI><P STYLE="margin-bottom: 0in">?Execute <CODE>$CWFOLDER/bin/IDE.exe</CODE>, using the <CODE>.elf</CODE> file as an argument. 41 </P> 42 </UL> 43 <LI><P STYLE="margin-bottom: 0in">?Launch <CODE>$CWFOLDER/bin/IDE.exe</CODE>, then drag the <CODE>.elf</CODE> file. 44 </P> 45 <LI><P>If the <CODE>.elf</CODE> file is associated with <CODE>$CWFOLDER/bin/IDE.exe</CODE>, double-click the <CODE>.elf</CODE> file. 46 </P> 47</UL> 48 49<H2>Description</H2> 50<P><FONT COLOR="#ff0000"><B>Note:</b> These sample demos demonstrate the use of the USB keyboard (KBD) library. To verify the operation of these demos, you must insert a USB Keyboard into a USB Port.</FONT>All demos except <CODE>kbdLowLevel</CODE> also use a GameCube Controller plugged into Controller Port 1.</P> 51 52<TABLE class="demo_list" border="1" > 53<tr bgcolor="#c0c0c0"><td><p>Demo Name</p></td><td><p>Description</p></td></tr> 54 <TR> 55 <TH>kbdLowLevel</TH> 56 <TD> 57 <P>Shows how to use the low-level KBD callback interface. Prints the USB HID code which is output every time a key is pressed and released on the USB keyboard.</P> 58 </TD> 59 </TR> 60 <TR> 61 <TH>kbdUTF8</TH> 62 <TD> 63 <P>Shows how to use the high-level KBD callback interface. Translates each key press into its UTF-8 equivalent; for keys that do not have an equivalent, translates each key press into a descriptive string.</P> 64 <P>To set the next country for the keyboard, use the A Button on Nintendo GameCube Controller.</P> 65 <P>To set the previous country for the keyboard, use the B Button on Nintendo GameCube Controller.</P> 66 <P>To change the keyboard channel affected by the A or B Button, use the X Button on Nintendo GameCube Controller.</P> 67 <P>To print a sample UTF-8 string, use the Y Button on Nintendo GameCube Controller. This makes sure that your terminal program gives you proper UTF-8 output.</P> 68 </TD> 69 </TR> 70 <TR> 71 <TH>kbdLowLevelSync</TH> 72 <TD> 73 <P>Shows how to use the low-level interface for KBD synchronous functions.<BR>Prints the USB HID code, which is output every time a key on the USB keyboard is pressed and released.</P> 74 <P>Use Nintendo GameCube Controller R Button to make the application sleep for 5 seconds. This makes it possible to verify overflow operation.</P> 75 </TD> 76 </TR> 77 <TR> 78 <TH>kbdUTF8Sync</TH> 79 <TD> 80 <P>Shows how to use the high-level interface for KBD synchronous functions.<BR>Translates each key press into its UTF-8 equivalent; for keys that do not have an equivalent, translates each key press into a descriptive string.</P> 81 <P>To set the next country for the keyboard, use the A Button on Nintendo GameCube Controller.</P> 82 <P>To set the previous country for the keyboard, use the B Button on Nintendo GameCube Controller.</P> 83 <P>To change the keyboard channel affected by the A or B Button, use the X Button on Nintendo GameCube Controller.</P> 84 <P>To print a sample UTF-8 string, use the Y Button on Nintendo GameCube Controller. This makes sure that your terminal program gives you proper UTF-8 output.</P> 85 <P>To make the application sleep for 5 seconds, use the R Button on Nintendo GameCube Controller. This makes it possible to verify overflow operation.</P> 86 87 </TD> 88 </TR> 89</TABLE> 90<p>In the high-level demos, we have implemented switching between the Japanese and Greek languages. For Japanese, use the Katana-Hiragana key; for Greek, use ALT+SPACE.</p> 91 92<H2>See Also</H2> 93<P class="reference"> 94<A HREF="../list.html">KBD Functions</A> 95</P> 96 97<H2>Revision History</H2> 98<P> 992007/03/20 Initial version.<br> 100</P> 101 102<hr><p>CONFIDENTIAL</p></body> 103</HTML>