MentOS  0.8.0
The Mentoring Operating System
keymap.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include "stdint.h"
13 
15 typedef enum {
21 
23 typedef struct keymap_t {
25  int normal;
27  int shift;
29  int ctrl;
31  int alt;
33  int numlock;
35 
39 
43 
44 
48 const keymap_t *get_keymap(unsigned int scancode);
49 
51 void init_keymaps(void);
52 
56 
57 #define KEY_ESCAPE 0x0001U
58 #define KEY_1 0x0002U
59 #define KEY_2 0x0003U
60 #define KEY_3 0x0004U
61 #define KEY_4 0x0005U
62 #define KEY_5 0x0006U
63 #define KEY_6 0x0007U
64 #define KEY_7 0x0008U
65 #define KEY_8 0x0009U
66 #define KEY_9 0x000AU
67 #define KEY_0 0x000BU
68 #define KEY_APOSTROPHE 0x000CU
69 #define KEY_I_ACC 0x000DU
70 #define KEY_BACKSPACE 0x000EU
71 #define KEY_TAB 0x000FU
72 #define KEY_Q 0x0010U
73 #define KEY_W 0x0011U
74 #define KEY_E 0x0012U
75 #define KEY_R 0x0013U
76 #define KEY_T 0x0014U
77 #define KEY_Y 0x0015U
78 #define KEY_U 0x0016U
79 #define KEY_I 0x0017U
80 #define KEY_O 0x0018U
81 #define KEY_P 0x0019U
82 #define KEY_LEFT_BRAKET 0x001AU
83 #define KEY_RIGHT_BRAKET 0x001BU
84 #define KEY_ENTER 0x001CU
85 #define KEY_LEFT_CONTROL 0x001DU
86 #define KEY_A 0x001EU
87 #define KEY_S 0x001FU
88 #define KEY_D 0x0020U
89 #define KEY_F 0x0021U
90 #define KEY_G 0x0022U
91 #define KEY_H 0x0023U
92 #define KEY_J 0x0024U
93 #define KEY_K 0x0025U
94 #define KEY_L 0x0026U
95 #define KEY_SEMICOLON 0x0027U
96 #define KEY_DOUBLE_QUOTES 0x0028U
97 #define KEY_GRAVE 0x0029U
98 #define KEY_LEFT_SHIFT 0x002AU
99 #define KEY_BACKSLASH 0x002BU
100 #define KEY_Z 0x002cU
101 #define KEY_X 0x002dU
102 #define KEY_C 0x002eU
103 #define KEY_V 0x002fU
104 #define KEY_B 0x0030U
105 #define KEY_N 0x0031U
106 #define KEY_M 0x0032U
107 #define KEY_COMMA 0x0033U
108 #define KEY_PERIOD 0x0034U
109 #define KEY_MINUS 0x0035U
110 #define KEY_RIGHT_SHIFT 0x0036U
111 #define KEY_KP_MUL 0x0037U
112 #define KEY_LEFT_ALT 0x0038U
113 #define KEY_SPACE 0x0039U
114 #define KEY_CAPS_LOCK 0x003aU
115 #define KEY_F1 0x003BU
116 #define KEY_F2 0x003CU
117 #define KEY_F3 0x003DU
118 #define KEY_F4 0x003EU
119 #define KEY_F5 0x003FU
120 #define KEY_F6 0x0040U
121 #define KEY_F7 0x0041U
122 #define KEY_F8 0x0042U
123 #define KEY_F9 0x0043U
124 #define KEY_F10 0x0044U
125 #define KEY_NUM_LOCK 0x0045U
126 #define KEY_SCROLL_LOCK 0x0046U
127 #define KEY_KP7 0x0047U
128 #define KEY_KP8 0x0048U
129 #define KEY_KP9 0x0049U
130 #define KEY_KP_SUB 0x004AU
131 #define KEY_KP4 0x004BU
132 #define KEY_KP5 0x004CU
133 #define KEY_KP6 0x004DU
134 #define KEY_KP_ADD 0x004EU
135 #define KEY_KP1 0x004FU
136 #define KEY_KP2 0x0050U
137 #define KEY_KP3 0x0051U
138 #define KEY_KP0 0x0052U
139 #define KEY_KP_DEC 0x0053U
140 #define KEY_KP_LESS 0x0056U
141 #define KEY_F11 0x0057U
142 #define KEY_F12 0x0058U
143 #define KEY_KP_RETURN 0xE01cU
144 #define KEY_RIGHT_CONTROL 0xE01DU
145 #define KEY_KP_DIV 0xE035U
146 #define KEY_RIGHT_ALT 0xE038U
147 #define KEY_LEFT_WIN 0xE05bU
148 #define KEY_RIGHT_WIN 0xE05cU
149 #define KEY_INSERT 0xE052U
150 #define KEY_HOME 0xE047U
151 #define KEY_UP_ARROW 0xE048U
152 #define KEY_PAGE_UP 0xE049U
153 #define KEY_LEFT_ARROW 0xE04bU
154 #define KEY_DELETE 0xE053U
155 #define KEY_END 0xE04fU
156 #define KEY_PAGE_DOWN 0xE051U
157 #define KEY_RIGHT_ARROW 0xE04dU
158 #define KEY_DOWN_ARROW 0xE050U
159 #define CODE_BREAK 0x0080U
160 
162 
keymap_type_t get_keymap_type(void)
Returns the current keymap type.
Definition: keymap.c:16
const keymap_t * get_keymap(unsigned int scancode)
Returns the current keymap for the given scancode.
Definition: keymap.c:28
keymap_type_t
The list of supported keyboard layouts.
Definition: keymap.h:15
void set_keymap_type(keymap_type_t type)
Changes the current keymap type.
Definition: keymap.c:21
void init_keymaps(void)
Initializes the supported keymaps.
Definition: keymap.c:33
struct keymap_t keymap_t
Defines the mapping of a single scancode towards a set of characters.
@ KEYMAP_TYPE_MAX
The delimiter for the keyboard types.
Definition: keymap.h:19
@ KEYMAP_DE
Identifies the DE keyboard mapping.
Definition: keymap.h:18
@ KEYMAP_US
Identifies the US keyboard mapping.
Definition: keymap.h:17
@ KEYMAP_IT
Identifies the IT keyboard mapping.
Definition: keymap.h:16
Standard integer data-types.
Defines the mapping of a single scancode towards a set of characters.
Definition: keymap.h:23
int numlock
The mapping when numlock is active.
Definition: keymap.h:33
int shift
The mapping when shifted.
Definition: keymap.h:27
int alt
The mapping when alt is pressed.
Definition: keymap.h:31
int normal
The basic mapping.
Definition: keymap.h:25
int ctrl
The mapping when ctrl is pressed.
Definition: keymap.h:29