Keyboard (KBD) Sample Demo

Location

$REVOLUTION_SDK_ROOT/build/demos/kbddemo

Compilation

Go to the directory $REVOLUTION_SDK_ROOT/build/demos/kbddemo and type make. An executable (.elf) file will be generated under the path $REVOLUTION_SDK_ROOT/RVL/bin/demos/kbddemo/.

Execution

A USB keyboard is required to run all of these demos. A Nintendo GameCube Controller is also required for some demos.

For the kbdUTF8 and kbdUTF8Sync demos, a terminal that supports UTF-8 is required in order to correctly display output from non-English keyboards. Below, we describe one of the methods for displaying output correctly for these demos.

  1. Start up the Cygwin setup program and install the "ruby: Interpreted object-oriented scripting language" (under devel) Cygwin package.
  2. Install terminator.msi from http://software.jessies.org/terminator/.
  3. Double click on the Terminator icon on the desktop.
  4. Exit all serial terminal programs that had been running.
  5. In the Terminator window, run "uterm comX". Here, X is the serial out COM port number of the NDEV you are using. Uterm is located in $REVOLUTION_SDK_ROOT/X86/bin/.
  6. Run the kbdUTF8 demo as follows.
  7. (Enter Ctrl+C on the PC to exit Uterm.))

To run either of the demos, change to the $REVOLUTION_SDK_ROOT/RVL/bin/demos/kbddemo/ directory and do the following:

Description

Note: These sample demos demonstrate the use of the USB keyboard library (the KBD library). To verify the operation of these demos, you must insert a USB keyboard into the USB port. Demos other than kbdLowLevel are used by inserting a Nintendo GameCube controller into Port 1.

Demo Name

Description

kbdLowLevel

This sample shows how to use the low-level interface of the KBD callback function.
It prints the USB HID codes that are output each time a key on the USB keyboard is pressed or released.

kbdUTF8

This sample shows how to use the high-level interface of the KBD callback function.
It converts each keypress to the corresponding UTF-8; if there is no corresponding value, it converts each keypress to a descriptive string.

The A Button on the Nintendo GameCube Controller sets the next keyboard's country.

The B Button on the Nintendo GameCube Controller sets the previous keyboard's country.

The X Button on the Nintendo GameCube Controller switches the channel of the keyboard that is changed with either the A Button or the B Button.

The Y Button on the Nintendo GameCube Controller prints a sample UTF-8 string. This makes it possible to check whether or not the terminal you are using can output UTF-8 correctly.

kbdLowLevelSync

This sample shows how to use the low-level interface of the KBD synchronization function.
It prints the USB HID codes that are output each time a key on the USB keyboard is pressed or released.

The R Button on the Nintendo GameCube Controller will make the application sleep for 5 seconds. This makes it possible to verify overflow operation.

kbdUTF8Sync

This sample shows how to use the high-level interface of the KBD synchronization function.
It converts each keypress to the corresponding UTF-8; if there is no corresponding value, it converts each keypress to a descriptive string.

The A Button on the Nintendo GameCube Controller sets the next keyboard's country.

The B Button on the Nintendo GameCube Controller sets the previous keyboard's country.

The X Button on the Nintendo GameCube Controller switches the channel of the keyboard that is changed with either the A Button or the B Button.

The Y Button on the Nintendo GameCube Controller prints a sample UTF-8 string. This makes it possible to check whether or not the terminal you are using can output UTF-8 correctly.

The R Button on the Nintendo GameCube Controller will make the application sleep for 5 seconds. This makes it possible to verify overflow operation.

In the high-level demos, we have implemented switching between the Japanese and Greek languages. For Japanese, use the katakana/hiragana key, and for Greek, use Alt+Space.

See Also

KBD Functions

Revision History

2007/03/20 Initial version.


CONFIDENTIAL