Keyboard

4.4Modifying the Keyboard Matrix or Adding New Keys

The current keyboard matrix with the USB scan codes are shown in Table 4-1 on page 55. Custom- ers may modify the keyboard matrix or they may add new keys to their keyboard. The following sec- tions explain the procedure.

4.4.1Modifying the Keyboard Matrix

In the file kdefs.h, a table called default_keyboard_scan_table matches the keyboard matrix shown in Table 4-1 on page 55. By modifying this table, the keyboard matrix is automatically modified.

4.4.2Adding New Keys

Example

The customer wants to add a multimedia key called ‘My Computer’, which is located at Column 15 and Row 6 and has a scan code of 0x0194. The following steps must be performed:

1.Go to file kdefs.h, and search for default_keyboard_scan_table. In the Col 15 (0xF) section, mod- ify line 7 from {NO_DEVICE, NOKEY} to {DEVICE_2, 0x000E}. The 0x000E is the index into the device 2 table.

2.Go to the table called device_2_keyboard_scan_table within the same file and add the scan code of 0x0194 to the end of the table, as shown:

const UINT16 device_2_keyboard_scan_table[] =

{

0x0192, // Calculator 0x0223, // WWW Home 0x00CD, // Play/Pause 0x0221, // WWW Search 0x018A, // Mail 0x00E9, // Volume Up 0x00E2, // Mute 0x00B7, // Stop 0x00EA, // Volume Down 0x022A, // WWW Favorites 0x0225, // WWW Forward 0x0224, // WWW Back

0x00B6, // Scan Previous Track 0x00B5, // Scan Next Track

0x0194, // My Computer

};

3.Build the firmware, the new key ‘My Computer’ will work.

72

CY4672 Reference Design Guide, Document # 001-16968 Revision **

[+] Feedback

Page 72
Image 72
Cypress CY4672 Modifying the Keyboard Matrix or Adding New Keys, Build the firmware, the new key ‘My Computer’ will work