µGFX  2.9
version 2.9
ginput_keyboard_microcode.c
Go to the documentation of this file.
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.io/license.html
6  */
7 
8 /**
9  * @file src/ginput/ginput_keyboard_microcode.c
10  * @brief GINPUT keyboard standard microcode definitions.
11  */
12 
13 #include "../../gfx.h"
14 
15 #if GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD && !GKEYBOARD_LAYOUT_OFF
16 
18 
19 #if GKEYBOARD_LAYOUT_SCANCODE2_US
20 
21  #error "Keyboard Layout SCANCODE2_US is not fully implemented yet"
22 
23  gU8 KeyboardLayout_ScancodeSet2_US[] = {
24  KMC_HEADERSTART, KMC_HEADER_ID1, KMC_HEADER_ID2, KMC_HEADER_VER_1,
25 
26  KMC_RECORDSTART, 0x03, // Handle E0 codes (ignore for now assuming a single character)
27  KMC_TEST_LASTCODE, 0xE0,
28  KMC_ACT_DONE,
29  KMC_RECORDSTART, 0x03,
30  KMC_TEST_CODE, 0xE0,
31  KMC_ACT_STOP,
32 
33  KMC_RECORDSTART, 0x03, // Handle E1 codes (ignore for now assuming a single character)
34  KMC_TEST_LASTCODE, 0xE1,
35  KMC_ACT_DONE,
36  KMC_RECORDSTART, 0x03,
37  KMC_TEST_CODE, 0xE1,
38  KMC_ACT_STOP,
39 
40  KMC_RECORDSTART, 0x03, // Handle E2 codes (ignore for now assuming a single character)
41  KMC_TEST_LASTCODE, 0xE2,
42  KMC_ACT_DONE,
43  KMC_RECORDSTART, 0x03,
44  KMC_TEST_CODE, 0xE2,
45  KMC_ACT_STOP,
46 
47  KMC_RECORDSTART, 0x06, // KeyUp
48  KMC_TEST_CODEBIT, 0x80,
49  KMC_ACT_STATEBIT, GKEYSTATE_KEYUP_BIT,
50  KMC_ACT_CODEBIT, 0x80 | KMC_BIT_CLEAR,
51 
52  KMC_RECORDSTART, 0x05, // CapsLock (on keyup to avoid repeats)
53  KMC_TEST_CODE, 0x58,
54  KMC_TEST_STATEBIT, GKEYSTATE_KEYUP_BIT | KMC_BIT_CLEAR,
55  KMC_ACT_DONE,
56  KMC_RECORDSTART, 0x05,
57  KMC_TEST_CODE, 0x58,
58  KMC_ACT_STATEBIT, GKEYSTATE_CAPSLOCK_BIT | KMC_BIT_INVERT,
59  KMC_ACT_DONE,
60 
61  KMC_RECORDSTART, 0x05, // Detect Shift Keys
62  //KMC_ACT_LAYOUTBIT, SCANCODESET2_LAYOUT_E0_BIT | KMC_BIT_CLEAR,
63  KMC_ACT_STOP,
64 
65  KMC_RECORDSTART, 0x03,
66  KMC_ACT_CHARRANGE, 0x00,
67  KMC_ACT_DONE,
68 
69  KMC_RECORDSTART, 0x00,
70  };
71 #endif // GKEYBOARD_LAYOUT_SCANCODE2_US
72 
73 #endif // GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD && !GKEYBOARD_LAYOUT_OFF
GINPUT keyboard layout microcode definition.