root / proj / libs / kbc / include / keyboard.h @ 336
History | View | Annotate | Download (2.87 KB)
1 |
#ifndef KEYBOARD_H_INCLUDED
|
---|---|
2 |
#define KEYBOARD_H_INCLUDED
|
3 |
|
4 |
/**
|
5 |
* @defgroup keyboard keyboard
|
6 |
* @ingroup kbc
|
7 |
* @brief Keyboard module.
|
8 |
*
|
9 |
* @{
|
10 |
*/
|
11 |
|
12 |
#include "kbc.h" |
13 |
|
14 |
/** @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 |
/** @brief Enter Make Code */
|
43 |
#define ENTER_MAKE_CODE 0x1C |
44 |
/** @brief Enter Break Code */
|
45 |
#define ENTER_BREAK_CODE 0x9C |
46 |
/** @brief Backspace Make Code */
|
47 |
#define BACKSPACE_MAKE_CODE 0x0E |
48 |
/** @brief Backspace Break Code */
|
49 |
#define BACKSPACE_BREAK_CODE 0x8E |
50 |
/** @brief ESC Make Code */
|
51 |
#define ESC_MAKE_CODE 0x01 |
52 |
/** @brief ESC Break Code */
|
53 |
#define ESC_BREAK_CODE 0x81 |
54 |
|
55 |
/**
|
56 |
* @brief Subscribes Keyboard Interrupts and disables Minix Default IH.
|
57 |
* @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 |
int (subscribe_kbc_interrupt)(uint8_t interrupt_bit, int *interrupt_id); |
63 |
|
64 |
/**
|
65 |
* @brief Get scancode read from keyboard.
|
66 |
* @return Pointer to begin of scancode array (array with size 2)
|
67 |
*/
|
68 |
const uint8_t* keyboard_get_scancode(void); |
69 |
/**
|
70 |
* @brief Get state of reading (done).
|
71 |
* @return 1 if done, 0 otherwise
|
72 |
*/
|
73 |
int keyboard_get_done(void); |
74 |
/**
|
75 |
* @brief Get size of read scancode (1 or 2).
|
76 |
* @return Size of scancode
|
77 |
*/
|
78 |
int keyboard_get_size(void); |
79 |
/**
|
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 |
int keyboard_get_error(void); |
84 |
/**
|
85 |
* @brief KBC interrupt handler. Reads scancodes.
|
86 |
*/
|
87 |
void (kbc_ih)(void); |
88 |
/**
|
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 |
int (keyboard_poll)(uint8_t bytes[], uint8_t *size);
|
95 |
|
96 |
/**
|
97 |
* @}
|
98 |
*/
|
99 |
|
100 |
#endif //KEYBOARD_H_INCLUDED |