]> git.gir.st - tmk_keyboard.git/blob - host.h
Synchronous USART support for PS/2 on V-USB stack
[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 #if defined(HOST_PJRC)
30 # include "usb.h"
31 # if defined(KBD2_REPORT_KEYS) && KBD2_REPORT_KEYS > KBD_REPORT_KEYS
32 # define REPORT_KEYS KBD2_REPORT_KEYS
33 # else
34 # define REPORT_KEYS KBD_REPORT_KEYS
35 # endif
36 #elif defined(HOST_VUSB)
37 # define REPORT_KEYS 6
38 #endif
39
40 typedef struct {
41 uint8_t mods;
42 uint8_t rserved;
43 uint8_t keys[REPORT_KEYS];
44 } report_keyboard_t;
45
46 typedef struct {
47 uint8_t buttons;
48 int8_t x;
49 int8_t y;
50 int8_t v;
51 int8_t h;
52 } report_mouse_t;
53
54
55 #ifdef USB_NKRO_ENABLE
56 extern bool keyboard_nkro;
57 #endif
58
59 extern report_keyboard_t *keyboard_report;
60 extern report_keyboard_t *keyboard_report_prev;
61
62
63 uint8_t host_keyboard_leds(void);
64
65 /* keyboard report operations */
66 void host_add_key(uint8_t key);
67 void host_add_mod_bit(uint8_t mod);
68 void host_set_mods(uint8_t mods);
69 void host_add_code(uint8_t code);
70 void host_swap_keyboard_report(void);
71 void host_clear_keyboard_report(void);
72 uint8_t host_has_anykey(void);
73 uint8_t *host_get_keys(void);
74 uint8_t host_get_mods(void);
75
76
77 void host_send_keyboard_report(void);
78 void host_mouse_send(report_mouse_t *report);
79
80 #endif
Imprint / Impressum