Keyboard raw codes: Difference between revisions
(page for keyboard raw codes) |
m (→Keyboard raw codes: fixed the letter C, now has the right keycode 0x63) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
=== Layout for F256K and F256K2 keyboards === | === Layout for F256K and F256K2 keyboards === | ||
The images on the right side were prepared with this website: [https://www.keyboard-layout-editor.com/ https://www.keyboard-layout-editor.com/#/] | |||
Here are the definition JSON files that can be used in its Raw Data / Upload JSON functionality (use this if you ever need to modify these files as a starting point to your needs) | |||
https://github.com/Mu0n/F256MiscGoodies/tree/main/keycodes | |||
[[File:F256K and K2 base layout.png|frame|Just the keycaps]] | [[File:F256K and K2 base layout.png|frame|Just the keycaps]] | ||
[[File:F256k2.png|frame|With Raw keycodes in hex]] | |||
[[File: | |||
=== Example Usage in C === | === Example Usage in C === | ||
Latest revision as of 14:05, 18 August 2026
Keyboard raw codes
These hex codes are part of the events that can be fetched by the MicroKernel in the event.key.raw data from event.key.PRESSED or event.key.RELEASED events (for more information, see here: MicroKernel docs)
Layout for F256K and F256K2 keyboards
The images on the right side were prepared with this website: https://www.keyboard-layout-editor.com/#/
Here are the definition JSON files that can be used in its Raw Data / Upload JSON functionality (use this if you ever need to modify these files as a starting point to your needs)
https://github.com/Mu0n/F256MiscGoodies/tree/main/keycodes


Example Usage in C
(the following is made using the llvm-mos package found here: llvm-mos
The first step is to fetch the next event in the kernel event queue:
kernelNextEvent();
Next, verify the pending event with either a switch-case block, or a if:
these two events are relevant to keyboard strokes:
kernelEventData.type == kernelEvent(key.PRESSED) kernelEventData.type == kernelEvent(key.RELEASED)
Lastly, this is what must be checked against the raw keycodes listed above:
kernelEventData.key.raw
ie, this is a proper detection for a 'spacebar' hit:
kernelNextEvent();
if(kernelEventData.type == kernelEvent(key.PRESSED))
{
if(kernelEventData.key.raw == 0x20) printf("Spacebar was hit!");
}