Difference between revisions of "Example keypad simple matrix"

From wiki.emacinc.com
Jump to: navigation, search
(Created page with "{{ subst:Pgtempl | initials={{subst::Templateimpl:getinitials}} | project=OE 5.0 | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 }}")
 
 
Line 1: Line 1:
{{todo| NotStarted (04.12.2016-11:43->KY+)| Kyoungmeyer | project=OE 5.0,KY,NotStarted }}
+
{{todo| In Progress (04.12.2016-11:43->KY+)|Klint Youngmeyer| project=OE 5.0,KY,InProgress }}
 
{{#seo:
 
{{#seo:
 
|title=Example keypad simple matrix
 
|title=Example keypad simple matrix
Line 10: Line 10:
 
<!-- /****************************************  Page Description Text  ****************************************/ -->
 
<!-- /****************************************  Page Description Text  ****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
<span style="background:#00FF00;color:#FF0000;font-size:300%">'''''Put the page description text here.'''''</span>
+
This is a guide to the <code>keypad_simple_matrix</code> C example project included in the EMAC OE SDK.
 +
 
 +
The <code>keypad_simple_matrix</code> example C project demonstrates how to use a keypad with a SoM150ES carrier board. It provides examples of how to specify, inspect and test associations between character-data and keypad-keys.
 +
 
 +
The <code>keypad_simple_matrix</code> C example project creates one executable: <code>keypad_matrix</code>. The project also uses one configuration file: <code>keypad_matrix.conf</code>  
  
 
__TOC__
 
__TOC__
Line 18: Line 22:
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:bg | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
 
{{:Templateimpl:bg | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
 +
In order to use this example with Qt Creator, select the <code>keypad_simple_matrix</code> project from the list of EMAC examples. Choose a build directory outside of the  EMAC SDK, run CMake, and build the project. The project can now be deployed to a target SoM-150 based system.
  
 +
If Qt Creator is not being used, please refer to [[Getting_Started_with_the_EMAC_OE_SDK|Getting Started with the EMAC OE SDK]].
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*****************************************  General Information  *****************************************/ -->
 
<!-- /*****************************************  General Information  *****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:geninfo | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
 
{{:Templateimpl:geninfo | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
 +
To use the <code>keypad_simple_matrix</code> program requires the following hardware.
 +
* 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/som/som9G20.htm SOM-9G20M], [http://www.emacinc.com/products/system_on_module/SoM-9G25M SoM-9g25], [http://www.emacinc.com/products/system_on_module/SoM-9X25M SOM-9X25], and [http://www.emacinc.com/products/system_on_module/SoM-A5D35 SoM-A5D35] are all compatible and available from EMAC).<br />
 +
* A compatible keypad ([http://www.emacinc.com/sbc_microcontroller_addons.htm Available from EMAC], refer to item# E20-21 or E020-25. [https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCsQFjAA&url=http%3A%2F%2Fwww.in2tec.com%2Flib%2Fdownloadfile.php%3Ffilename%3D4000_series_keypads_datasheet.pdf%26loc%3Ddocuments%2F%26ct%3Dpdf&ei=Wf-MUrGxO-nEyQGggoGgCg&usg=AFQjCNEQxIaiH6-gx6uTq4O66o1YVDunZw&bvm=bv.56643336,d.aWc Datasheet]).
 +
 +
[[File:Som150 with keypad.JPG | 500px ]]<br />
 +
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.<br />
 +
[[File:Example getkey howtopluginthekeypad 0.png|500px]]
 +
 +
Ensure that '''pin 0''' of the keypad's ribbon cable is lined up with '''pin 2''' on the header.<br />
 +
[[File:Example getkey howtopluginthekeypad 1.png|500px]]
 +
===The Keypad Matrix File===
 +
 +
The keypad matrix file specifies associations between keypad-keys and characters. An example is shown below:
 +
<syntaxhighlight lang="console">
  
 +
# INPUT_CODE|OUTPUT_CHARACTER|
 +
0x02|1|
 +
0x03|2|
 +
0x04|3|
 +
0x05|4|
 +
0x06|5|
 +
0x07|6|
 +
0x08|7|
 +
0x09|8|
 +
0x0a|9|
 +
0x0b|0|
 +
0x1e|*|
 +
0x30|\n|
 +
0x2e|A|
 +
0x20|B|
 +
0x12|C|
 +
0x21|D|
 +
# Keycode translation that comes
 +
# from the default keypad mapping
 +
# in the EMAC  driver.
 +
#    ---------------------------------
 +
#    |  0,0  |  0,1  |  0,2  |  0,3  |
 +
#    | KEY_1 | KEY_2 | KEY_3 | KEY_C |
 +
#    | 0x02  | 0x03  | 0x04  | 0x2e  |
 +
#    ---------------------------------
 +
#    |  1,0  |  1,1  |  1,2  |  1,3  |
 +
#    | KEY_4 | KEY_5 | KEY_6 | KEY_D |
 +
#    | 0x05  | 0x06  | 0x07  | 0x20  |
 +
#    ---------------------------------
 +
#    |  2,0  |  2,1  |  2,2  |  2,3  |
 +
#    | KEY_7 | KEY_8 | KEY_9 | KEY_E |
 +
#    | 0x08  | 0x09  | 0x0a  | 0x12  |
 +
#    ---------------------------------
 +
#    |  3,0  |  3,1  |  3,2  |  3,3  |
 +
#    | KEY_A | KEY_0 | KEY_B | KEY_F |
 +
#    | 0x1e  | 0x0b  | 0x30  | 0x21  |
 +
#    ---------------------------------
 +
</syntaxhighlight>
 +
The default location for this file is the same directory as the executable.
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*****************************************  Using/Working With  ******************************************/ -->
 
<!-- /*****************************************  Using/Working With  ******************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
{{:Templateimpl:using | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
+
<!--{{:Templateimpl:using | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}-->
  
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
Line 33: Line 97:
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:examples | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
 
{{:Templateimpl:examples | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
 +
An example of the <code>keypad_simple_matrix</code> program being used is shown below:
 +
 +
{{clo}}
 +
{{clio |./keypad_matrix| hostname=soma5d35}}
 +
1234567890*ABCD
 +
 +
 +
{{clio || hostname=soma5d35}}
 +
{{clos}}
  
 +
The program will continue until a key with the value of '\n' is pressed. If no key has that value, the program will not exit.
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /******************************************    Conclusion      ******************************************/ -->
 
<!-- /******************************************    Conclusion      ******************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:conclusion | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
 
{{:Templateimpl:conclusion | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
 
+
The <code>keypad_simple_matrix</code> example C project demonstrates how to use a keypad with a SoM150ES carrier board.
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /******************************************  More Information  *****************************************/ -->
 
<!-- /******************************************  More Information  *****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
{{:Templateimpl:moreinfo | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
+
<!--{{:Templateimpl:moreinfo | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}-->
*
 
 
 
 
{{:Templateimpl:whatnext | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
 
{{:Templateimpl:whatnext | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}
*
+
*[[ARM_SOM|EMAC ARM Soms]]

Latest revision as of 11:19, 12 April 2016

TODO: {{#todo: In Progress (04.12.2016-11:43->KY+)|Klint Youngmeyer|OE 5.0,KY,InProgress}}

This is a guide to the keypad_simple_matrix C example project included in the EMAC OE SDK.

The keypad_simple_matrix example C project demonstrates how to use a keypad with a SoM150ES carrier board. It provides examples of how to specify, inspect and test associations between character-data and keypad-keys.

The keypad_simple_matrix C example project creates one executable: keypad_matrix. The project also uses one configuration file: keypad_matrix.conf

Background

In order to use this example with Qt Creator, select the keypad_simple_matrix project from the list of EMAC examples. Choose a build directory outside of the EMAC SDK, run CMake, and build the project. The project can now be deployed to a target SoM-150 based system.

If Qt Creator is not being used, please refer to Getting Started with the EMAC OE SDK.

General Information

To use the keypad_simple_matrix program requires 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

Ensure that pin 0 of the keypad's ribbon cable is lined up with pin 2 on the header.
Example getkey howtopluginthekeypad 1.png

The Keypad Matrix File

The keypad matrix file specifies associations between keypad-keys and characters. An example is shown below:

# INPUT_CODE|OUTPUT_CHARACTER|
0x02|1|
0x03|2|
0x04|3|
0x05|4|
0x06|5|
0x07|6|
0x08|7|
0x09|8|
0x0a|9|
0x0b|0|
0x1e|*|
0x30|\n|
0x2e|A|
0x20|B|
0x12|C|
0x21|D|
# Keycode translation that comes 
# from the default keypad mapping
# in the EMAC  driver.
#    ---------------------------------
#    |  0,0  |  0,1  |  0,2  |  0,3  |
#    | KEY_1 | KEY_2 | KEY_3 | KEY_C |
#    | 0x02  | 0x03  | 0x04  | 0x2e  |
#    ---------------------------------
#    |  1,0  |  1,1  |  1,2  |  1,3  |
#    | KEY_4 | KEY_5 | KEY_6 | KEY_D |
#    | 0x05  | 0x06  | 0x07  | 0x20  |
#    ---------------------------------
#    |  2,0  |  2,1  |  2,2  |  2,3  |
#    | KEY_7 | KEY_8 | KEY_9 | KEY_E |
#    | 0x08  | 0x09  | 0x0a  | 0x12  |
#    ---------------------------------
#    |  3,0  |  3,1  |  3,2  |  3,3  |
#    | KEY_A | KEY_0 | KEY_B | KEY_F |
#    | 0x1e  | 0x0b  | 0x30  | 0x21  |
#    ---------------------------------

The default location for this file is the same directory as the executable.

Examples

An example of the keypad_simple_matrix program being used is shown below:

root@soma5d35:~# ./keypad_matrix

1234567890*ABCD


root@soma5d35:~#

The program will continue until a key with the value of '\n' is pressed. If no key has that value, the program will not exit.

Conclusion

The keypad_simple_matrix example C project demonstrates how to use a keypad with a SoM150ES carrier board.

Pages with Related Content