Included is a simple sample program that can be used to demonstrate the capabilities of the Emerson library, from the simplest AT byte transfer protocol to handling scancode translation on a keyboard and the scrollwheel on a mouse.
The structure of the demonstration is a series of menus similar to the TIOS menus, which you should find easy enough to navigate.
This is the simplest possible part of the library. You can type in bytes (in hexadecimal notation) which are sent to the connected device. Any bytes received will be displayed on the screen along with your input.
To send a byte, just press the 0-9 keys or the A-F keys. You do not need to press the Alpha modifier at any point. To quit, press Clear. You will need to have pressed two keys to send a byte.
Bytes you send are displayed in inverted text (white on black). If the byte is not sent successfully, ?? is displayed instead. Received bytes are displayed in normal (black on white) text. You can clear the display by pressing Del.
Examples:
This tries to connect to a device and determine what it is. It will display one of the following device types:
This demonstration prints the results of the Keyboard.GetScancode routine. Each time a scancode is received by the calculator, a row of information is displayed:
This demonstration lets you type away on your keyboard and see the results on-screen. You must have a keyboard layout definition file installed on the calculator.
The demonstration is not very fully-featured, only providing the most basic text editing functionality. It doesn't keep track of entered characters, just displays them as you type. Hence the functionality of some keys (Delete, Backspace, Tab and so on) are simulated in a slightly odd way.
It works by calling the Keyboard.GetKey routine. This routine:
The demos are designed to be hot-pluggable.
This tries to work out what sort of mouse is connected. Whilst it repeatedly tries to initialise the mouse, the run indicator will appear. You can exit at any time. Finally, when the mouse has been identified, it will display the type on-screen and wait for a key press. Unlike your PC, this part is effectively "hot-pluggable" - just leave it waiting at the Initialise menu, then plug in your device.
This primitive demonstration just displays the current X, Y and Z coordinates on screen along with the button status bit array. Note that the Z coordinate will not be visible if you do not have an Intellimouse (with a scroll wheel) attached.
Two of the bits in the buttons bit array correspond to the direction the mouse was moved in (one for X, one for Y). These values are only intended for internal use, and as such the Y direction is never inverted, even if you request that it is in the configuration file.
Press any key to return to the menu at any time. Note that if the display is blank, it means that the library isn't successfully running updates with the mouse.
The range of values in this demo are very small (restricted to keep the cursor on-screen for the Cursor demo). In reality, the X and Y values can go the full range of the 16-bit counters.
This demonstration displays a cursor on the screen that can be moved around with the mouse. It is safely clipped by the library to the edges of the display.
You can scribble on the screen by clicking and dragging the mouse. If the cursor vanishes, it's because the mouse cannot be detected.
Press Del to clear the screen. Any other key will exit.