root / proj / libs / kbc / include / keyboard.h @ 343
History | View | Annotate | Download (2.87 KB)
1 | 334 | up20180642 | #ifndef KEYBOARD_H_INCLUDED
|
---|---|---|---|
2 | #define KEYBOARD_H_INCLUDED
|
||
3 | |||
4 | 145 | up20180655 | /**
|
5 | 334 | up20180642 | * @defgroup keyboard keyboard
|
6 | * @ingroup kbc
|
||
7 | * @brief Keyboard module.
|
||
8 | *
|
||
9 | * @{
|
||
10 | 145 | up20180655 | */
|
11 | |||
12 | 257 | up20180642 | #include "kbc.h" |
13 | |||
14 | 334 | up20180642 | /** @brief W Make Code */
|
15 | #define W_MAKE_CODE 0x11 |
||
16 | /** @brief W Break Code */
|
||
17 | #define W_BREAK_CODE 0x91 |
||
18 | /** @brief A Make Code */
|
||
19 | #define A_MAKE_CODE 0x1E |
||
20 | /** @brief A Break Code */
|
||
21 | #define A_BREAK_CODE 0x9E |
||
22 | /** @brief S Make Code */
|
||
23 | #define S_MAKE_CODE 0x1F |
||
24 | /** @brief S Break Code */
|
||
25 | #define S_BREAK_CODE 0x9F |
||
26 | /** @brief D Make Code */
|
||
27 | #define D_MAKE_CODE 0x20 |
||
28 | /** @brief D Break Code */
|
||
29 | #define D_BREAK_CODE 0xA0 |
||
30 | /** @brief CTRL Make Code */
|
||
31 | #define CTRL_MAKE_CODE 0x1D |
||
32 | /** @brief CTRL Break Code */
|
||
33 | #define CTRL_BREAK_CODE 0x9D |
||
34 | /** @brief Plus (+) Make Code */
|
||
35 | #define PLUS_MAKE_CODE 0x1A |
||
36 | /** @brief Plus (+) Break Code */
|
||
37 | #define PLUS_BREAK_CODE 0x9A |
||
38 | /** @brief Minus (-) Make Code */
|
||
39 | #define MINUS_MAKE_CODE 0x35 |
||
40 | /** @brief Minus (-) Break Code */
|
||
41 | #define MINUS_BREAK_CODE 0xB5 |
||
42 | 336 | up20180642 | /** @brief Enter Make Code */
|
43 | 298 | up20180642 | #define ENTER_MAKE_CODE 0x1C |
44 | 336 | up20180642 | /** @brief Enter Break Code */
|
45 | 298 | up20180642 | #define ENTER_BREAK_CODE 0x9C |
46 | 336 | up20180642 | /** @brief Backspace Make Code */
|
47 | 298 | up20180642 | #define BACKSPACE_MAKE_CODE 0x0E |
48 | 336 | up20180642 | /** @brief Backspace Break Code */
|
49 | 298 | up20180642 | #define BACKSPACE_BREAK_CODE 0x8E |
50 | 336 | up20180642 | /** @brief ESC Make Code */
|
51 | #define ESC_MAKE_CODE 0x01 |
||
52 | /** @brief ESC Break Code */
|
||
53 | #define ESC_BREAK_CODE 0x81 |
||
54 | 298 | up20180642 | |
55 | 153 | up20180655 | /**
|
56 | 334 | up20180642 | * @brief Subscribes Keyboard Interrupts and disables Minix Default IH.
|
57 | 153 | up20180655 | * @param interrupt_bit Bit of Interrupt Vector that will be set when Keyboard Interrupt is pending
|
58 | * @param interrupt_id Keyboard Interrupt ID to specify the Keyboard Interrupt in other calls
|
||
59 | * @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
||
60 | * @see {_ERRORS_H_::errors}
|
||
61 | */
|
||
62 | 145 | up20180655 | int (subscribe_kbc_interrupt)(uint8_t interrupt_bit, int *interrupt_id); |
63 | |||
64 | 336 | up20180642 | /**
|
65 | * @brief Get scancode read from keyboard.
|
||
66 | * @return Pointer to begin of scancode array (array with size 2)
|
||
67 | */
|
||
68 | 321 | up20180642 | const uint8_t* keyboard_get_scancode(void); |
69 | 336 | up20180642 | /**
|
70 | * @brief Get state of reading (done).
|
||
71 | * @return 1 if done, 0 otherwise
|
||
72 | */
|
||
73 | 321 | up20180642 | int keyboard_get_done(void); |
74 | 336 | up20180642 | /**
|
75 | * @brief Get size of read scancode (1 or 2).
|
||
76 | * @return Size of scancode
|
||
77 | */
|
||
78 | 321 | up20180642 | int keyboard_get_size(void); |
79 | 336 | up20180642 | /**
|
80 | * @brief Get error code of previous run of kbc_ih, if an error occured.
|
||
81 | * @return Error code, or 0 if successful
|
||
82 | */
|
||
83 | 321 | up20180642 | int keyboard_get_error(void); |
84 | 336 | up20180642 | /**
|
85 | * @brief KBC interrupt handler. Reads scancodes.
|
||
86 | */
|
||
87 | 145 | up20180655 | void (kbc_ih)(void); |
88 | 336 | up20180642 | /**
|
89 | * @brief Poll keyboard for scancodes.
|
||
90 | * @param bytes Array to put read bytes (up to 2)
|
||
91 | * @param size Number of ready bytes (1 or 2)
|
||
92 | * @return SUCCESS if operation was successful, other value otherwise
|
||
93 | */
|
||
94 | 145 | up20180655 | int (keyboard_poll)(uint8_t bytes[], uint8_t *size);
|
95 | |||
96 | 334 | up20180642 | /**
|
97 | * @}
|
||
98 | */
|
||
99 | |||
100 | 145 | up20180655 | #endif //KEYBOARD_H_INCLUDED |