FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
keyboard.h
Go to the documentation of this file.
1
11#ifndef KEYBOARD_H
12#define KEYBOARD_H
13
14#include <basics.h>
15#include <stdbool.h>
16#include <hal.h>
17#include <isr.h>
18
19#define MOD_LCTRL 0x01U
20#define MOD_RCTRL 0x02U
21#define MOD_CTRL 0x03U
22#define MOD_LSHIFT 0x04U
23#define MOD_RSHIFT 0x08U
24#define MOD_SHIFT 0x4CU
25#define MOD_LALT 0x10U
26#define MOD_RALT 0x20U
27#define MOD_ALT 0x30U
28#define MOD_CAPSLOCK 0x40U
29#define MOD_NUMLOCK 0x80U
30
31#define CUR_UP -1
32#define CUR_DOWN -2
33#define CUR_LEFT -3
34#define CUR_RIGHT -4
35
36#define KB_BUFFER_SIZE 256
37
44char scancode_to_char(int scancode, bool uppercase);
45
50void keyboard_init(void);
51
57
61uint8_t getmodifiers(void);
62
68uint8_t getc(void);
69
75int getc_nonblock(void);
76
81
88int handle_char_from_scancode(uint8_t data);
89
90#endif
This is a basic header files with FrostWing specific short forms and basically a good for life header...
Header file for Hardware Abstraction Layer -> Source from GoGX OS.
Interrupts handler header.
int getc_nonblock(void)
Non-blocking getc from keyboard buffer.
uint8_t getmodifiers(void)
Gets the current modifiers (like lshift, rshift, etc.).
void keyboard_init(void)
Initalizes the RingBuffer to store the characters.
void process_keyboard(InterruptFrame *frame)
This is a function that is ran even when the sleep() function is called.
uint8_t getc(void)
Gets the last pressed char.
void keyboard_flush_buffer(void)
Clears pending keyboard input so stale keypresses are discarded.
int handle_char_from_scancode(uint8_t data)
Converts the scancode passed to it to ASCII characters.
char scancode_to_char(int scancode, bool uppercase)
Converts the scancode to character.