feat(idt): use new ring_buffer functions

This commit is contained in:
aliamelo committed 2021-07-17 05:27:44 +02:00
1 parent 0b394c2c08
commit 1cb57e6a9f
4 files changed
+16 -12

No files matched your search

+11 -3
View File
@@ -1,12 +1,20 @@
#include "pic/keyboard.h"
#include "io.h"
#include "stdio.h"
#include "utils/ring_buffer.h"
int8_t getkey(void)
static struct ring_buffer keyboard_buffer = { 0 };
void add_key_to_buffer(void)
{
uint8_t key = inb(KEYBOARD_IO);
write_entry(&keyboard_buffer, key);
}
if (key & KEYBOARD_RELEASE)
int getkey(void)
{
uint8_t key = read_entry(&keyboard_buffer);
if (!key)
return -1;
return key;
+2 -1
View File
@@ -8,6 +8,7 @@
#include <stdint.h>
int8_t getkey(void);
void add_key_to_buffer(void);
int getkey(void);
#endif /* !KEYBOARD_H */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.