root / lab3 / keyboard.h @ 363
History | View | Annotate | Download (1.08 KB)
1 | 60 | up20180642 | /**
|
---|---|---|---|
2 | * This file concerns everything related to the keyboard
|
||
3 | */
|
||
4 | |||
5 | #ifndef KEYBOARD_H_INCLUDED
|
||
6 | #define KEYBOARD_H_INCLUDED
|
||
7 | |||
8 | /**
|
||
9 | * @brief Subscribes KBC Interrupts and disables Minix Default Keyboard IH
|
||
10 | * @param interrupt_bit Bit of Interrupt Vector that will be set when KBC Interrupt is pending
|
||
11 | * @param interrupt_id KBC Interrupt ID to specify the KBC Interrupt in other calls
|
||
12 | * @return Whether operation was sucessful or not
|
||
13 | */
|
||
14 | int (subscribe_keyboard_interrupt)(uint8_t interrupt_bit, int *interrupt_id); |
||
15 | |||
16 | uint8_t scancode[2];
|
||
17 | 67 | up20180642 | int keyboard_done;
|
18 | int scancode_sz;
|
||
19 | 60 | up20180642 | int got_error_keyboard;
|
20 | |||
21 | /**
|
||
22 | * @brief KBC Interrupt Handler
|
||
23 | */
|
||
24 | void (kbc_ih)(void); |
||
25 | |||
26 | /**
|
||
27 | * @brief High-level function that polls keyboard for scancode
|
||
28 | * High-level function that polls keyboard for scancode of up to 2 bytes. If
|
||
29 | * scancode has only 1 byte, the second byte is set to 0x00.
|
||
30 | * @param bytes Array of at least 2 bytes to store scancode
|
||
31 | * @param size Size of scancode in bytes
|
||
32 | * @return 0 if operation was successful, 1 otherwise
|
||
33 | */
|
||
34 | int (keyboard_poll)(uint8_t bytes[], uint8_t *size);
|
||
35 | |||
36 | #endif //KEYBOARD_H_INCLUDED |