forked from EtchedPixels/EmulatorKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasciikbd_none.c
More file actions
46 lines (38 loc) · 718 Bytes
/
asciikbd_none.c
File metadata and controls
46 lines (38 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include "asciikbd.h"
struct asciikbd {
uint8_t key;
unsigned int ready;
};
struct asciikbd *asciikbd_create(void)
{
struct asciikbd *kbd = malloc(sizeof(struct asciikbd));
if (kbd == NULL) {
fprintf(stderr, "Out of memory.\n");
exit(1);
}
kbd->ready = 0;
return kbd;
}
void asciikbd_free(struct asciikbd *kbd)
{
free(kbd);
}
unsigned int asciikbd_ready(struct asciikbd *kbd)
{
return kbd->ready;
}
uint8_t asciikbd_read(struct asciikbd *kbd)
{
return kbd->key;
}
void asciikbd_ack(struct asciikbd *kbd)
{
kbd->ready = 0;
}
void asciikbd_event(struct asciikbd *kbd)
{
}