Keyboard raw codes: Difference between revisions

From F256 Foenix
Jump to navigationJump to search
(page for keyboard raw codes)
(No difference)

Revision as of 06:18, 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

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