MCPcopy Create free account
hub / github.com/kiibohd/controller / ScancodeDispatch

Function ScancodeDispatch

Scan/PS2/scan_loop.c:70–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68
69
70void ScancodeDispatch() {
71 static uint8_t state = 0x01; // pressed
72 static uint8_t is_extended = 0;
73 while (1)
74 {
75 uint8_t c = get_scan_code();
76 if (c)
77 {
78 if (verbose_state)
79 {
80 printHex(c);
81 print(" ");
82 }
83 switch (c)
84 {
85 case 0xF0: // F0, is release for next scancode.
86 state = 0x03; // release
87 break;
88 case 0xE0: // extended scancode.
89 is_extended = 1;
90 break;
91 default:
92 // printHex(c);
93 // printHex(state);
94 // print(" ");
95 if (is_extended) {
96 // map the extended values to 0x80+c, this conveniently does not
97 // collide with the non-extended set.
98 c = 0x80 + c;
99 }
100 Macro_keyState(c, state); // send the new state
101 state = 0x01; // default state is pressed
102 is_extended = 0; // default is non extended
103 }
104 }
105 else
106 {
107 return;
108 }
109 }
110}
111
112
113

Callers 1

Scan_loopFunction · 0.85

Calls 2

get_scan_codeFunction · 0.85
Macro_keyStateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…