![]() |
Max OS 0.3
|
Interprets the scan codes from the keyboard for the EN_US keyboard layout. More...
#include <keyboard.h>
Public Types | |
| enum class | KeyCodeEN_US { escape = 0x01 , f1 = 0x3B , f2 = 0x3C , f3 = 0x3D , f4 = 0x3E , f5 = 0x3F , f6 = 0x40 , f7 = 0x41 , f8 = 0x42 , f9 = 0x43 , f10 = 0x44 , f11 = 0x57 , f12 = 0x58 , printScreen = 0x37 , scrollLock = 0x46 , pauseBreak = 0x45 , squigglyLine = 0x29 , one = 0x02 , two = 0x03 , three = 0x04 , four = 0x05 , five = 0x06 , six = 0x07 , seven = 0x08 , eight = 0x09 , nine = 0x0A , zero = 0x0B , minus = 0x0C , equals = 0x0D , backspace = 0x0E , insert = 0x52 , home = 0x47 , pageUp = 0x49 , numberPadLock = 0x45 , numberPadForwardSlash = 0x35 , numberPadMultiply = 0x37 , numberPadMinus = 0x4A , tab = 0x0F , Q = 0x10 , W = 0x11 , E = 0x12 , R = 0x13 , T = 0x14 , Y = 0x15 , U = 0x16 , I = 0x17 , O = 0x18 , P = 0x19 , openSquareBracket = 0x1A , closeSquareBracket = 0x1B , backslash = 0x2B , deleteKey = 0x53 , end = 0x4F , pageDown = 0x51 , numberPadSeven = 0x47 , numberPadEight = 0x48 , numberPadNine = 0x49 , numberPadPlus = 0x4E , capsLock = 0x3A , A = 0x1E , S = 0x1F , D = 0x20 , F = 0x21 , G = 0x22 , H = 0x23 , J = 0x24 , K = 0x25 , L = 0x26 , semicolon = 0x27 , apostrophe = 0x28 , enter = 0x1C , numberPadFour = 0x4B , numberPadFive = 0x4C , numberPadSix = 0x4D , leftShift = 0x2A , Z = 0x2C , X = 0x2D , C = 0x2E , V = 0x2F , B = 0x30 , N = 0x31 , M = 0x32 , comma = 0x33 , fullStop = 0x34 , forwardSlash = 0x35 , rightShift = 0x36 , upArrow = 0x48 , numberPadOne = 0x4F , numberPadTwo = 0x50 , numberPadThree = 0x51 , numberPadEnter = 0x1C , leftControl = 0x1D , leftOS = 0x5B , leftAlt = 0x38 , space = 0x39 , rightAlt = 0x38 , function = 0x5D , rightControl = 0x1D , leftArrow = 0x4B , downArrow = 0x50 , rightArrow = 0x4D , numberPadZero = 0x52 , numberPadFullStop = 0x53 } |
| The scan codes for the EN_US keyboard layout. More... | |
Public Member Functions | |
| KeyboardInterpreterEN_US () | |
| Construct a new Keyboard Interpreter for the EN_US layout. | |
| void | on_stream_read (uint8_t scan_code) final |
| Handle the key down event. | |
Public Member Functions inherited from MaxOS::drivers::peripherals::KeyboardInterpreter | |
| KeyboardInterpreter () | |
| Construct a new Keyboard Interpreter object. | |
| void | on_key_read (bool, const KeyboardState &, KeyCode) |
| Handle the key event. | |
Public Member Functions inherited from MaxOS::common::InputStreamEventHandler< uint8_t > | |
| InputStreamEventHandler () | |
| _______________________________________________TEMPLATES_________________________________________________________________/// | |
| ~InputStreamEventHandler () | |
| Destroys the InputStreamProcessor and disconnects it from all streams. | |
| virtual void | on_stream_read (uint8_t) |
| Called when data is read from a stream (overridden by subclasses) | |
| virtual void | on_end_of_stream (GenericInputStream< uint8_t > *) |
| Called when a stream has finished. Removes the stream from the array of streams. | |
Public Member Functions inherited from MaxOS::common::EventManager< KeyboardEvents > | |
| void | connect_event_handler (EventHandler< KeyboardEvents > *handler) |
| connect an event handler to the event manager if it is not already connected | |
| void | disconnect_event_handler (EventHandler< KeyboardEvents > *handler) |
| disconnect an event handler from the event manager if it is connected | |
| Vector< Event< KeyboardEvents > * > | raise_event (Event< KeyboardEvents > *event) |
| Calls the on_event function of all the event m_handlers connected to the event manager and returns a list of the results. | |
Additional Inherited Members | |
Protected Attributes inherited from MaxOS::drivers::peripherals::KeyboardInterpreter | |
| KeyboardState | m_keyboard_state |
| The current state of what special keys are pressed on the keyboard. | |
| bool | m_next_is_first_extended_code = false |
| If true, the next code should be interpreted as an extended code (set when receiving 0xE0) | |
| uint8_t | m_extended_scan_code_bytes = 0 |
| How many bytes are left to read for the current extended scan code. | |
| uint16_t | m_extended_code_buffer = 0 |
| The storage for scan codes that take more than one byte. | |
Protected Attributes inherited from MaxOS::common::InputStreamEventHandler< uint8_t > | |
| common::Vector< GenericInputStream< uint8_t > * > | m_generic_input_streams |
| List of streams being observed by this handler. | |
Protected Attributes inherited from MaxOS::common::EventManager< KeyboardEvents > | |
| Vector< EventHandler< KeyboardEvents > * > | m_handlers |
Interprets the scan codes from the keyboard for the EN_US keyboard layout.
Definition at line 310 of file keyboard.h.
|
strong |
The scan codes for the EN_US keyboard layout.
Definition at line 318 of file keyboard.h.
| KeyboardInterpreterEN_US::KeyboardInterpreterEN_US | ( | ) |
Construct a new Keyboard Interpreter for the EN_US layout.
Definition at line 156 of file keyboard.cpp.
Handle the key down event.
| scan_code | The scan code of the key that was pressed |
First row
Second row
Fourth row
Fifth row
Sixth row
Definition at line 171 of file keyboard.cpp.
References MaxOS::drivers::peripherals::KeyboardState::caps_lock, MaxOS::drivers::peripherals::KeyboardState::left_alt, MaxOS::drivers::peripherals::KeyboardState::left_control, MaxOS::drivers::peripherals::KeyboardState::left_shift, MaxOS::drivers::peripherals::KeyboardInterpreter::m_extended_code_buffer, MaxOS::drivers::peripherals::KeyboardInterpreter::m_extended_scan_code_bytes, MaxOS::drivers::peripherals::KeyboardInterpreter::m_keyboard_state, MaxOS::drivers::peripherals::KeyboardInterpreter::m_next_is_first_extended_code, MaxOS::drivers::peripherals::KeyboardState::number_pad_lock, MaxOS::drivers::peripherals::KeyboardInterpreter::on_key_read(), MaxOS::drivers::peripherals::KeyboardState::right_alt, MaxOS::drivers::peripherals::KeyboardState::right_control, and MaxOS::drivers::peripherals::KeyboardState::right_shift.