feat(keyboard): add getkey function
This commit is contained in:
1 parent
a98c35a226
commit
d255839400
3 files changed
+44
-1
No files matched your search
@@ -0,0 +1,13 @@
|
||||
#include "pic/keyboard.h"
|
||||
#include "io.h"
|
||||
#include "stdio.h"
|
||||
|
||||
int8_t getkey(void)
|
||||
{
|
||||
uint8_t key = inb(KEYBOARD_IO);
|
||||
|
||||
if (key & KEYBOARD_RELEASE)
|
||||
return -1;
|
||||
|
||||
return key;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef KEYBOARD_H
|
||||
#define KEYBOARD_H
|
||||
|
||||
#define KEYBOARD_IO 0x60
|
||||
#define KEYBOARD_STATUS 0x64
|
||||
|
||||
#define KEYBOARD_RELEASE 0x80
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
int8_t getkey(void);
|
||||
|
||||
#endif /* !KEYBOARD_H */
|
||||