Kernel: Add basic PS/2 Mouse driver

This commit is contained in:
Bananymous
2022-12-30 19:38:21 +02:00
parent 3c92aa45fb
commit ef0b2010e0
10 changed files with 318 additions and 137 deletions

View File

@@ -6,7 +6,7 @@ namespace APIC
{
void Initialize(bool force_pic = false);
void EOI();
void EOI(uint8_t irq);
void GetISR(uint32_t[8]);
void EnableIRQ(uint8_t irq);

View File

@@ -2,7 +2,7 @@
#include <stdint.h>
namespace Keyboard
namespace Input
{
enum class Key : uint8_t
@@ -37,13 +37,30 @@ namespace Keyboard
bool pressed;
};
bool initialize();
void update_keyboard();
enum class MouseButton
{
Left, Right, Middle,
};
struct MouseButtonEvent
{
MouseButton button;
};
void register_key_event_callback(void(*callback)(KeyEvent));
struct MouseMoveEvent
{
int16_t dx;
int16_t dy;
};
bool initialize();
void update();
bool is_key_down(Key);
void register_key_event_callback(void (*callback)(KeyEvent));
void register_mouse_button_event_callback(void (*callback)(MouseButtonEvent));
void register_mouse_move_event_callback(void (*callback)(MouseMoveEvent));
const char* key_event_to_utf8(KeyEvent);
void led_disco();
}

View File

@@ -1,8 +1,8 @@
#pragma once
#include <kernel/Keyboard.h>
#include <kernel/Input.h>
namespace Keyboard
namespace Input
{
constexpr Key scan_code_to_key_extended[0xFF]

View File

@@ -1,7 +1,7 @@
#pragma once
#include <BAN/String.h>
#include <kernel/Keyboard.h>
#include <kernel/Input.h>
#include <kernel/TTY.h>
namespace Kernel
@@ -22,7 +22,7 @@ namespace Kernel
Shell();
void PrintPrompt();
void ProcessCommand(const BAN::Vector<BAN::StringView>&);
void KeyEventCallback(Keyboard::KeyEvent);
void KeyEventCallback(Input::KeyEvent);
private:
TTY* m_tty;