Keyboard raw codes: Difference between revisions

From F256 Foenix
Jump to navigationJump to search
(page for keyboard raw codes)
 
 
(One intermediate revision 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]]

Latest revision as of 06:27, 10 June 2025

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


Just the keycaps
With Raw keycodes in hex

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!");
}