22 lines
355 B
C
22 lines
355 B
C
#include "pic/keyboard.h"
|
|
#include "io.h"
|
|
#include "utils/ring_buffer.h"
|
|
|
|
static struct ring_buffer keyboard_buffer = { 0 };
|
|
|
|
void keyboard_handler(void)
|
|
{
|
|
uint8_t key = inb(KEYBOARD_IO);
|
|
write_entry(&keyboard_buffer, key);
|
|
}
|
|
|
|
int getkey(void)
|
|
{
|
|
uint8_t key = read_entry(&keyboard_buffer);
|
|
|
|
if (!key)
|
|
return -1;
|
|
|
|
return key;
|
|
}
|