CoolPotOS/include/keyboard.h

32 lines
643 B
C
Raw Normal View History

2024-04-09 23:46:56 +08:00
#ifndef CRASHPOWEROS_KEYBOARD_H
#define CRASHPOWEROS_KEYBOARD_H
#define KEYBOARD_DATA_PORT 0x60
#define KEYBOARD_STATUS_PORT 0x64
2024-04-15 22:53:46 +08:00
#include <stdint.h>
2024-04-09 23:46:56 +08:00
typedef struct {
int is_shift;
2024-04-10 22:21:09 +08:00
int is_ctrl;
int is_esc;
2024-04-09 23:46:56 +08:00
}KEY_STATUS;
typedef struct {
unsigned char *keyboard_map[128];
unsigned char *shift_keyboard_map[128];
}KEY_MAP;
2024-04-15 22:53:46 +08:00
typedef struct key_listener{
2024-04-20 02:43:22 +08:00
int lid;
2024-04-15 22:53:46 +08:00
void (*func)(uint32_t key,int release,char c);
struct key_listener *next;
}kl_t;
2024-04-09 23:46:56 +08:00
void init_keyboard();
int handle_keyboard_input();
2024-04-15 22:53:46 +08:00
void add_listener(struct key_listener* listener);
2024-04-20 02:43:22 +08:00
void remove_listener(int lid);
2024-04-09 23:46:56 +08:00
#endif //CRASHPOWEROS_KEYBOARD_H