How to use keyboard on OMAP 3530 EVM
Romanian flag

      If you may have the necesity to grab a key, from the OMAP3530 EVM board, and you do not know how, here is the solution.

      To grab a key, someone can intercept one of the following messages WM_CHAR or WM_KEYDOWN, in any MFC application, but the most general approach is to override the PreTranslateMessage virtual function in order to peek any keyboard message before it is processed by the standard MFC code.

OmapBoard

      Both functions C…App::PreTranslateMessage() and C…Dlg::PreTranslateMessage() can be override and you need to consider which one serves to your goals better. C…App::PreTranslateMessage() is a global function and gives you powerful capability - every message going through the main message loop is checked, but a mistake can make the application run weirdly. C…Dlg::PreTranslateMessage() is local to its own dialog window and all the code is locally. In my program booth C…App::PreTranslateMessage() and C…Dlg::PreTranslateMessage() are overwritten and based on OutputDebugString an information message is send to the debug window every time when a key is pressed.

      To override a virtual function in the Properties window do the following (http://msdn.microsoft.com/en-us/library/f4dbfs09.aspx):

1.     In Class View, click the desired class in which you will override the PreTranslateMessage() function.

2.     In the Properties window, click the Overrides button - the Overrides button is available when you select either the class name in Class View or when you click within the source window.

3.     The left column lists the virtual functions. If the name of a virtual function also appears in the right column, then an override has already been implemented.

4.     If the function has no override, then click the cell in the right column in the Properties window to display the suggested name of the function override as <add>FuncName.

5.     Click the suggested name to add stub code for the function.

6.     To edit an overriding function, double-click the name of the function in Class View and edit the code in the source window.

 

7.     To remove an override, click the override function name in the right column and select <delete>FuncName. The function's code is commented out.

      The application present here for download incorporate only the main functions used to handle the OMAP3530 keyboard. The same principles apply for BeagleBoard.

Interface

      The buttons 11 is not used in the project. By pressing 2, 3, 4, 6, 8, 10, 13, 14 the proper checkbox will be marked. Because the buttons 7, 9, 12 have the same address” (“Wparam=0” - when press one of them), all three boxes (7, 9, 12) will be marked, also the buttons 1 and 5 generate the same code (“Wparam = 27”) and they were treated together.

      If CWinApp::PreTranslateMessage() returns TRUE, the message is believed to be processed already and does not go down on the stream. If you override C…Dlg::PreTranslateMessage(), you must follow this convention. Normally, buttons 1, 5 and 15 are used by OS as close an application (Alt+F4 combination), if you are handling them in your program return TRUE, otherwise use {return CDialog::PreTranslateMessage(pMsg);} to be able to close your application when one of them are pushed. The key 11 is used for windows start menu.

The program was build in Visual Studio 2008 environment based on MFC Smart Device Application template and tested on OMAP3530 EVM board and Pocket PC 2003 SDK.
Download the program code source

Back
Main Frame (acces to all the site)
Course of Intelligent Embedded Systems
"Gheorghe Asachi" Technical University of Iasi
Faculty of Electronics, Telecommunications and Information Technology
Associate Professor Dan Marius Dobrea