formatting and make events const
This commit is contained in:
@@ -18,7 +18,7 @@ bool caps_lock = false;
|
||||
static keyboard_handler_t keyboard_handlers[KEYBOARD_HANDLERS_LENGTH];
|
||||
static int handler_index = 0;
|
||||
|
||||
void handle_keyboard(isr_frame_t* frame)
|
||||
void handle_keyboard(const isr_frame_t* frame)
|
||||
{
|
||||
uint8_t code = inb(0x60);
|
||||
uint8_t scan_code = code & 0x7F;
|
||||
@@ -42,7 +42,12 @@ void handle_keyboard(isr_frame_t* frame)
|
||||
}
|
||||
default:
|
||||
{
|
||||
keyboard_event_t event = { .scan_code = scan_code, .pressed = pressed, .caps_lock = caps_lock, .shift = shift };
|
||||
keyboard_event_t event = {
|
||||
.scan_code = scan_code,
|
||||
.pressed = pressed,
|
||||
.caps_lock = caps_lock,
|
||||
.shift = shift,
|
||||
};
|
||||
|
||||
for (int i = 0; i < handler_index; i++)
|
||||
{
|
||||
@@ -52,9 +57,10 @@ void handle_keyboard(isr_frame_t* frame)
|
||||
}
|
||||
}
|
||||
|
||||
void register_keypress_handler(keyboard_handler_t handler)
|
||||
void register_keypress_handler(const keyboard_handler_t handler)
|
||||
{
|
||||
// todo(nub31): remove when a memory allocator is implemented and keyboard_handlers is a dynamic list
|
||||
// todo(nub31): remove when a memory allocator is implemented and
|
||||
// keyboard_handlers is a dynamic list
|
||||
if (handler_index >= KEYBOARD_HANDLERS_LENGTH)
|
||||
{
|
||||
vga_print_error();
|
||||
|
||||
Reference in New Issue
Block a user