Keyboard raw codes

From F256 Foenix
Revision as of 06:18, 10 June 2025 by 1BitFeverDreams (talk | contribs) (page for keyboard raw codes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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

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