Difference between revisions of "Example getkey"

From wiki.emacinc.com
Jump to: navigation, search
(Description, Usage and Expected Behaviour)
(Description, Usage and Expected Behaviour)
Line 24: Line 24:
 
This is an example program for mapping keypad input to a character matrix using the keypad interface on the SOM-150ES.  
 
This is an example program for mapping keypad input to a character matrix using the keypad interface on the SOM-150ES.  
  
''To use this program you will need the appropriate hardware:''<br />
+
===Necessary Hardware===
 +
 
 +
To use the '''getkey''' program you will need the following hardware.
 +
 
 
* A [http://www.emacinc.com/som/som150es.htm SOM-150ES carrier board] (Available from EMAC).<br />
 
* A [http://www.emacinc.com/som/som150es.htm SOM-150ES carrier board] (Available from EMAC).<br />
 
* A compatible '''SoM''' for that carrier board ([http://www.emacinc.com/products/system_on_module/SoM-9260M SOM-9260M], [http://www.emacinc.com/som/som9G20.htm SOM-9G20M] and [http://www.emacinc.com/som/som9x25.htm SOM-9X25] are all compatible and available from EMAC).<br />
 
* A compatible '''SoM''' for that carrier board ([http://www.emacinc.com/products/system_on_module/SoM-9260M SOM-9260M], [http://www.emacinc.com/som/som9G20.htm SOM-9G20M] and [http://www.emacinc.com/som/som9x25.htm SOM-9X25] are all compatible and available from EMAC).<br />
Line 32: Line 35:
 
SOM-150ES carrier board with keypad
 
SOM-150ES carrier board with keypad
  
'''Usage for getkey'''
+
===Plugging the Keypad into the SOM-150ES Carrier Board===
 +
 
 +
Plug the '''keypad''' into the '''HDR5 KEYPAD header''' of the '''SOM-150ES Carrier Board'''.<br />
 +
[[File:Example getkey howtopluginthekeypad 0.png|500px]]
 +
 
 +
Make sure that you line up '''pin 0''' of the keypad's ribbon cable with '''pin 2''' of the header.<br />
 +
[[File:Example getkey howtopluginthekeypad 1.png|500px]]
 +
 
 +
===Usage for getkey===
  
 
;d:Specifies the device node. The default is <code>/dev/keypad</code>
 
;d:Specifies the device node. The default is <code>/dev/keypad</code>

Revision as of 15:33, 20 November 2013

TODO: {{#todo:InProgress(11.14.13-11:41->JG+);(11.14.13-15:30->MD-);(11.19.13-13:52->JG+)|Jgreene|oe 4,oe 5,jg,md,Review}}

This procedure provides an overview of how to open, build and run the getkey C example project using the Eclipse IDE.

Opening, Building and Uploading the Project Files

1. Open the C/C++ editing perspective.

stub

2. Open the getkey project files.

stub

3. Build the getkey project.

stub

4. Upload the getkey binary to the target machine.

stub

Description, Usage and Expected Behaviour

This is an example program for mapping keypad input to a character matrix using the keypad interface on the SOM-150ES.

Necessary Hardware

To use the getkey program you will need the following hardware.

Som150 with keypad.JPG
SOM-150ES carrier board with keypad

Plugging the Keypad into the SOM-150ES Carrier Board

Plug the keypad into the HDR5 KEYPAD header of the SOM-150ES Carrier Board.
Example getkey howtopluginthekeypad 0.png

Make sure that you line up pin 0 of the keypad's ribbon cable with pin 2 of the header.
Example getkey howtopluginthekeypad 1.png

Usage for getkey

d
Specifies the device node. The default is /dev/keypad
b
Activates read blocking. The program will sleep until a key on the keypad is pressed.
g
Returns the current keypad matrix.
s
Sets the keypad matrix to that of the specified matrix file. (See project for example file Key-E020-21). If a matrix operation is not specified then the last key pressed is returned.

Note Arguments are evaluated in order. If blocking or device specifications are used, they must be declared before the matrix arguments on the command line.

Usage Example. Mapping the Keypad to a Matrix File

./getkey -d /dev/keypad0 -s Key-E020-21

The program will map the keypad at /dev/keypad0 to the matrix file Key-E020-21.

Usage Example. Displaying the Matrix Presently Associated with the Keypad

./getkey -d /dev/keypad0 -g

The program will display the matrix presently associated with the keypad at /dev/keypad0.

File:Example getkey terminal session sample 0.png

The matrix displayed here is that of the Key-E020-21 file.

Usage Example. Displaying the Character Presently Mapped to a Key on the Keypad

./getkey -d /dev/keypad0 -b

The program will wait until a key is pressed on the keypad. When a key is pressed it will display the corresponding character mapped to that pressed key, as specified in the matrix file.

File:Example getkey terminal session sample 1.png
In this case I pressed the 5 key on the keypad.