Max OS 0.3
Loading...
Searching...
No Matches
keyboard.h File Reference

Defines a Keyboard and related classes for handling keyboard input. More...

#include <common/map.h>
#include <common/eventHandler.h>
#include <common/inputStream.h>
#include <common/string.h>
#include <common/vector.h>
#include <drivers/driver.h>
#include <hardwarecommunication/interrupts.h>
#include <hardwarecommunication/port.h>
#include <hardwarecommunication/apic.h>
#include <cstdint>

Go to the source code of this file.

Classes

class  MaxOS::drivers::peripherals::KeyboardState
 Holds the state of the keyboard. More...
 
class  MaxOS::drivers::peripherals::KeyUpEvent
 Event that is triggered when a key is released. More...
 
class  MaxOS::drivers::peripherals::KeyDownEvent
 Event that is triggered when a key is pressed. More...
 
class  MaxOS::drivers::peripherals::KeyboardEventHandler
 Handles the events that are triggered by the Keyboard Driver. More...
 
class  MaxOS::drivers::peripherals::KeyboardInterpreter
 Interprets the scan codes from the keyboard. More...
 
class  MaxOS::drivers::peripherals::KeyboardInterpreterEN_US
 Interprets the scan codes from the keyboard for the EN_US keyboard layout. More...
 
class  MaxOS::drivers::peripherals::KeyboardDriver
 Driver for the Keyboard Controller, manages the events and the keyboard state. More...
 

Enumerations

enum class  MaxOS::drivers::peripherals::ScanCodeType : int { REGULAR , EXTENDED , EXTENDED_BUFFER }
 The type of scan code being sent by the keyboard. More...
 
enum class  MaxOS::drivers::peripherals::KeyCode : uint16_t {
  A = 'A' , a = 'a' , B = 'B' , b = 'b' ,
  C = 'C' , c = 'c' , D = 'D' , d = 'd' ,
  E = 'E' , e = 'e' , F = 'F' , f = 'f' ,
  G = 'G' , g = 'g' , H = 'H' , h = 'h' ,
  I = 'I' , i = 'i' , J = 'J' , j = 'j' ,
  K = 'K' , k = 'k' , L = 'L' , l = 'l' ,
  M = 'M' , m = 'm' , N = 'N' , n = 'n' ,
  O = 'O' , o = 'o' , P = 'P' , p = 'p' ,
  Q = 'Q' , q = 'q' , R = 'R' , r = 'r' ,
  S = 'S' , s = 's' , T = 'T' , t = 't' ,
  U = 'U' , u = 'u' , V = 'V' , v = 'v' ,
  W = 'W' , w = 'w' , X = 'X' , x = 'x' ,
  Y = 'Y' , y = 'y' , Z = 'Z' , z = 'z' ,
  zero = '0' , one = '1' , two = '2' , three = '3' ,
  four = '4' , five = '5' , six = '6' , seven = '7' ,
  eight = '8' , nine = '9' , comma = ',' , fullStop = '.' ,
  exclamationMark = '!' , questionMark = '?' , quotationMark = '\"' , semicolon = ';' ,
  colon = ':' , apostrophe = '\'' , slantedApostrophe = '`' , powerSign = '^' ,
  dollarSign = '$' , percentSign = '' , andSign = '&' , atSign = '@' ,
  underscore = '_' , lineThing = '|' , hash = '#' , backslash = '\\' ,
  forwardSlash = '/' , squigglyLine = '~' , plus = '+' , minus = '-' ,
  equals = '=' , multiply = '*' , lessThan = '<' , greaterThan = '>' ,
  openBracket = '(' , closeBracket = ')' , openSquareBracket = '[' , closeSquareBracket = ']' ,
  openCurlyBracket = '{' , closeCurlyBracket = '}' , space = ' ' , tab = '\t' ,
  enter = '\n' , backspace = '\b' , f1 = 1000 , f2 ,
  f3 , f4 , f5 , f6 ,
  f7 , f8 , f9 , f10 ,
  f11 , f12 , escape , printScreen ,
  scrollLock , pauseBreak , upArrow , downArrow ,
  leftArrow , rightArrow , insert , home ,
  pageUp , deleteKey , end , pageDown ,
  capsLock , leftShift , leftControl , leftOS ,
  leftAlt , rightAlt , functionKey , rightControl ,
  rightShift , numberPadLock , numberPadForwardSlash , numberPadMultiply ,
  numberPadMinus , numberPadPlus , numberPadEnter , numberPadZero ,
  numberPadOne , numberPadTwo , numberPadThree , numberPadFour ,
  numberPadFive , numberPadSix , numberPadSeven , numberPadEight ,
  numberPadNine , numberPadFullStop , numberPadHome , numberPadPageDown ,
  numberPadPageUp , numberPadEnd , numberPadInsert , numberPadUpArrow ,
  numberPadDownArrow , numberPadLeftArrow , numberPadRightArrow
}
 A mapping of key codes to their values. More...
 
enum class  MaxOS::drivers::peripherals::KeyboardEvents { KEYDOWN , KEYUP }
 The events that can be triggered by the Keyboard Driver. More...
 

Detailed Description

Defines a Keyboard and related classes for handling keyboard input.

Date
9th October 2022
Author
Max Tyson

Definition in file keyboard.h.

Enumeration Type Documentation

◆ KeyboardEvents

The events that can be triggered by the Keyboard Driver.

Definition at line 239 of file keyboard.h.

239 {
240 KEYDOWN,
241 KEYUP
242 };

◆ KeyCode

enum class MaxOS::drivers::peripherals::KeyCode : uint16_t
strong

A mapping of key codes to their values.

Enumerator
f1 

OTHER CODES THAT ARE NOT CHARACTERS ///.

Definition at line 40 of file keyboard.h.

40 : uint16_t {
41
42 // Alphabet
43 A = 'A', a = 'a',
44 B = 'B', b = 'b',
45 C = 'C', c = 'c',
46 D = 'D', d = 'd',
47 E = 'E', e = 'e',
48 F = 'F', f = 'f',
49 G = 'G', g = 'g',
50 H = 'H', h = 'h',
51 I = 'I', i = 'i',
52 J = 'J', j = 'j',
53 K = 'K', k = 'k',
54 L = 'L', l = 'l',
55 M = 'M', m = 'm',
56 N = 'N', n = 'n',
57 O = 'O', o = 'o',
58 P = 'P', p = 'p',
59 Q = 'Q', q = 'q',
60 R = 'R', r = 'r',
61 S = 'S', s = 's',
62 T = 'T', t = 't',
63 U = 'U', u = 'u',
64 V = 'V', v = 'v',
65 W = 'W', w = 'w',
66 X = 'X', x = 'x',
67 Y = 'Y', y = 'y',
68 Z = 'Z', z = 'z',
69
70 // Numbers
71 zero = '0',
72 one = '1',
73 two = '2',
74 three = '3',
75 four = '4',
76 five = '5',
77 six = '6',
78 seven = '7',
79 eight = '8',
80 nine = '9',
81
82 // Symbols
83 comma = ',',
84 fullStop = '.',
85 exclamationMark = '!',
86 questionMark = '?',
87 quotationMark = '\"',
88 semicolon = ';',
89 colon = ':',
90 apostrophe = '\'',
91 slantedApostrophe = '`',
92
93 // Signs
94 powerSign = '^',
95 dollarSign = '$',
96 percentSign = '%',
97 andSign = '&',
98 atSign = '@',
99
100 // Special Characters
101 underscore = '_',
102 lineThing = '|',
103 hash = '#',
104 backslash = '\\',
105 forwardSlash = '/',
106 squigglyLine = '~',
107
108 // Math Symbols
109 plus = '+',
110 minus = '-',
111 equals = '=',
112 multiply = '*',
113 lessThan = '<',
114 greaterThan = '>',
115
116 // Brackets
117 openBracket = '(',
118 closeBracket = ')',
119 openSquareBracket = '[',
120 closeSquareBracket = ']',
121 openCurlyBracket = '{',
122 closeCurlyBracket = '}',
123
124 // Writing
125 space = ' ',
126 tab = '\t',
127 enter = '\n',
128 backspace = '\b',
129
131
132 // Functions
133 f1 = 1000, //force it to start at 1000 so it doesn't conflict with ascii
134 f2,
135 f3,
136 f4,
137 f5,
138 f6,
139 f7,
140 f8,
141 f9,
142 f10,
143 f11,
144 f12,
145
146 // Top Row
147 escape,
148 printScreen,
149 scrollLock,
150 pauseBreak,
151
152 // Arrow s
153 upArrow,
154 downArrow,
155 leftArrow,
156 rightArrow,
157
158 // Keys Above Arrows
159 insert,
160 home,
161 pageUp,
162 deleteKey,
163 end,
164 pageDown,
165
166 // Left Side
167 capsLock,
168 leftShift,
169 leftControl,
170 leftOS, //weird ass Windows key or command on Mac
171 leftAlt,
172
173 // Right Side
174 rightAlt,
175 functionKey,
176 rightControl,
177 rightShift,
178
179 // Number Pad
180 numberPadLock,
181 numberPadForwardSlash,
182 numberPadMultiply,
183 numberPadMinus,
184 numberPadPlus,
185 numberPadEnter,
186 numberPadZero,
187 numberPadOne,
188 numberPadTwo,
189 numberPadThree,
190 numberPadFour,
191 numberPadFive,
192 numberPadSix,
193 numberPadSeven,
194 numberPadEight,
195 numberPadNine,
196 numberPadFullStop,
197
198 // Number Pad (Non Number Lock)
199 numberPadHome,
200 numberPadPageDown,
201 numberPadPageUp,
202 numberPadEnd,
203 numberPadInsert,
204 numberPadUpArrow,
205 numberPadDownArrow,
206 numberPadLeftArrow,
207 numberPadRightArrow,
208 };
@ f1
OTHER CODES THAT ARE NOT CHARACTERS ///.

◆ ScanCodeType

The type of scan code being sent by the keyboard.

Definition at line 30 of file keyboard.h.

30 : int {
31 REGULAR,
32 EXTENDED,
33 EXTENDED_BUFFER
34 };