]> git.gir.st - tmk_keyboard.git/blob - host.h
refactor keyboard.h, host.h
[tmk_keyboard.git] / host.h
1 #ifndef HOST_H
2 #define HOST_H
3
4 #include <stdint.h>
5
6
7 /* keyboard Modifiers in boot protocol report */
8 #define BIT_LCTRL (1<<0)
9 #define BIT_LSHIFT (1<<1)
10 #define BIT_LALT (1<<2)
11 #define BIT_LGUI (1<<3)
12 #define BIT_RCTRL (1<<4)
13 #define BIT_RSHIFT (1<<5)
14 #define BIT_RALT (1<<6)
15 #define BIT_RGUI (1<<7)
16 #define BIT_LCTL BIT_LCTRL
17 #define BIT_RCTL BIT_RCTRL
18 #define BIT_LSFT BIT_LSHIFT
19 #define BIT_RSFT BIT_RSHIFT
20
21 /* mouse buttons */
22 #define MOUSE_BTN1 (1<<0)
23 #define MOUSE_BTN2 (1<<1)
24 #define MOUSE_BTN3 (1<<2)
25 #define MOUSE_BTN4 (1<<3)
26 #define MOUSE_BTN5 (1<<4)
27
28
29 #define REPORT_KEYS 6
30 typedef struct {
31 uint8_t mods;
32 uint8_t rserved;
33 uint8_t keys[REPORT_KEYS];
34 } report_keyboard_t;
35
36 typedef struct {
37 uint8_t buttons;
38 int8_t x;
39 int8_t y;
40 /*
41 int8_t v;
42 int8_t h;
43 */
44 } report_mouse_t;
45
46
47 extern report_keyboard_t *keyboard_report;
48 extern report_keyboard_t *keyboard_report_prev;
49
50
51 /* keyboard report operations */
52 void host_add_key(uint8_t key);
53 void host_add_mod_bit(uint8_t mod);
54 void host_set_mods(uint8_t mods);
55 void host_add_code(uint8_t code);
56 void host_swap_keyboard_report(void);
57 void host_clear_keyboard_report(void);
58 uint8_t host_has_anykey(void);
59 uint8_t *host_get_keys(void);
60 uint8_t host_get_mods(void);
61
62
63 void host_send_keyboard_report(void);
64 void host_send_mouse_report(void);
65 void host_mouse_send(report_mouse_t *report);
66
67 #endif
Imprint / Impressum