The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
layouts.c File Reference

the list of built-in keyboard layouts, and the active one. More...

#include "keyboard_layout.h"
#include "common/stddef.h"

Macros

#define LAYOUT_COUNT   (sizeof(layouts) / sizeof(layouts[0]))

Typedefs

typedef const keyboard_layout_t *(*) layout_fn_t(void)

Functions

const keyboard_layout_t * keyboard_get_layout (void)
 get the active keyboard layout.
const keyboard_layout_t * keyboard_layout_at (uint32_t index)
 a built-in layout by its index (layouts.c has the list).
uint32_t keyboard_layout_index (void)
 the index of the active layout.
bool keyboard_set_layout (uint32_t index)
 make a built-in layout the active one.

Detailed Description

the list of built-in keyboard layouts, and the active one.

the keyboard interrupt reads the active index on every key press; a switch writes it once, so no lock is needed.

Macro Definition Documentation

◆ LAYOUT_COUNT

#define LAYOUT_COUNT   (sizeof(layouts) / sizeof(layouts[0]))

Typedef Documentation

◆ layout_fn_t

typedef const keyboard_layout_t *(*) layout_fn_t(void)

Function Documentation

◆ keyboard_get_layout()

const keyboard_layout_t * keyboard_get_layout ( void )

get the active keyboard layout.

Returns
pointer to the active layout.

◆ keyboard_layout_at()

const keyboard_layout_t * keyboard_layout_at ( uint32_t index)

a built-in layout by its index (layouts.c has the list).

Returns
the layout, or NULL past the last one.

◆ keyboard_layout_index()

uint32_t keyboard_layout_index ( void )

the index of the active layout.

◆ keyboard_set_layout()

bool keyboard_set_layout ( uint32_t index)

make a built-in layout the active one.

the next key press uses it.

Returns
false if there is no layout with this index.