Difference between revisions of "Example getkey"

From wiki.emacinc.com
Jump to: navigation, search
(Description, Usage and Expected Behaviour)
Line 22: Line 22:
 
== Description, Usage and Expected Behaviour ==
 
== 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. To use this program you will need the appropriate hardware.
+
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 />
 
A '''SOM-150ES carrier board'''.<br />
 
A '''SOM-150ES carrier board'''.<br />
 
A compatible '''SoM''' for that carrier board ('''SOM-9260M''', '''SOM-9620M''' and '''SOM-9X25''' all work and are available from EMAC).<br />
 
A compatible '''SoM''' for that carrier board ('''SOM-9260M''', '''SOM-9620M''' and '''SOM-9X25''' all work and are available from EMAC).<br />
A compatible keypad (Available from EMAC, item# E202-21).  
+
A compatible '''keypad''' (Available from EMAC, item# E202-21).  
 
   
 
   
It requires a SOM-150ES board and the keypad that goes with it.
+
'''Usage for getkey'''
  
'''Usage for getkey'''
+
    <code>getkey [-d device -b -g -s file]</code>
  '''The getkey line needs to be in courier'''                             
+
{| class="wikitable"
getkey [-d device -b -g -s file]<br />  
+
|-
'''This needs to be in a table, with bold to indicate the command letter. Device nodes (/dev/keypad) don't belong in italics; they belong in courier. Similarly, filenames should be in courier.  Each description of a command should be an actual sentence, and should be structured as such. In cases like 'd', there should be more than one sentence, or the description should be reworded into a form that fits into one sentence.'''  
+
| '''d''' || Specifies the device node. The default is <code>/dev/keypad</code>
 +
|-
 +
| '''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 <code>Key-E020-21</code>). If a matrix operation is not specified then the last key pressed is returned.
 +
|}
  
d: specify the device node, default is ''/dev/keypad''<br />
+
'''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.
b: read blocking, sleep until a key is pressed.<br />   
 
g: returns the current keypad matrix.<br />       
 
s: sets the keypad matrix to the matrix specified in file (see project for example file ''Key-E020-21'').<br />
 
If a matrix operation is not specified then the last key pressed is returned.<br />
 
'''Blank lines should be inserted before notes.  The word note, as I mentioned before, should be in bold.'''
 
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 #1 needs to be specified as a heading, not just put in bold.  It also needs to be capitalized as a proper heading, and needs to be given a name rather than a sequential number.  The same applies to the rest of the usage examples.  Additionally, example output should be given.'''
 
'''Usage example #1 needs to be specified as a heading, not just put in bold.  It also needs to be capitalized as a proper heading, and needs to be given a name rather than a sequential number.  The same applies to the rest of the usage examples.  Additionally, example output should be given.'''
  
'''Usage example #1'''
+
====Usage Example #1====
'''All code must be in a code block so that it shows in courier'''
+
 
./getkey -d /dev/keypad0 -g
+
    <code>./getkey -d /dev/keypad0 -g</code>
  
 
The program will display the matrix presently associated with the keypad at ''/dev/keypad0''.
 
The program will display the matrix presently associated with the keypad at ''/dev/keypad0''.
  
'''Usage example #2'''
+
====Usage Example #2====
  
./getkey -d /dev/keypad0 -s Key-E020-21
+
    <code>./getkey -d /dev/keypad0 -s Key-E020-21</code>
  
 
The program will map the keypad at ''/dev/keypad0'' to the matrix file ''Key-E020-21''.
 
The program will map the keypad at ''/dev/keypad0'' to the matrix file ''Key-E020-21''.
  
'''Usage example #3'''
+
====Usage Example #3====
  
./getkey -d /dev/keypad0 -b
+
    <code>./getkey -d /dev/keypad0 -b</code>
  
 
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.
 
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.

Revision as of 11:50, 19 November 2013

TODO: {{#todo:InProgress(11.14.13-11:41->JG+);(11.14.13-15:30->MD-);(11.19.13-09:13->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 egpc project files.

stub

3. Build the egpc project.

stub

4. Upload the egpc 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.

To use this program you will need the appropriate hardware:
A SOM-150ES carrier board.
A compatible SoM for that carrier board (SOM-9260M, SOM-9620M and SOM-9X25 all work and are available from EMAC).
A compatible keypad (Available from EMAC, item# E202-21).

Usage for getkey

   getkey [-d device -b -g -s file]
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 #1 needs to be specified as a heading, not just put in bold. It also needs to be capitalized as a proper heading, and needs to be given a name rather than a sequential number. The same applies to the rest of the usage examples. Additionally, example output should be given.

Usage Example #1

   ./getkey -d /dev/keypad0 -g

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

Usage Example #2

   ./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 #3

   ./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.