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 0b00000001
20#define MOD_RCTRL 0b00000010
21#define MOD_CTRL 0b00000011
22#define MOD_LSHIFT 0b00000100
23#define MOD_RSHIFT 0b00001000
24#define MOD_SHIFT 0b01001100
25#define MOD_LALT 0b00010000
26#define MOD_RALT 0b00100000
27#define MOD_ALT 0b00110000
28#define MOD_CAPSLOCK 0b01000000
29#define MOD_NUMLOCK 0b10000000
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
51
57
61uint8_t getmodifiers();
62
68uint8_t getc();
69
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()
Non-blocking getc from keyboard buffer.
uint8_t getc()
Gets the last pressed char.
void process_keyboard(InterruptFrame *frame)
This is a function that is ran even when the sleep() function is called.
void keyboard_init()
Initalizes the RingBuffer to store the characters.
void keyboard_flush_buffer(void)
Clears pending keyboard input so stale keypresses are discarded.
uint8_t getmodifiers()
Gets the current modifiers (like lshift, rshift, etc.).
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.