]> git.gir.st - tmk_keyboard.git/blob - host.h
Add special keycodes for media control. Fix power down command.
[tmk_keyboard.git] / host.h
1 #ifndef HOST_H
2 #define HOST_H
3
4 #include <stdint.h>
5
6
7 /* report id */
8 #define REPORT_ID_MOUSE 1
9 #define REPORT_ID_SYSTEM 2
10 #define REPORT_ID_CONSUMER 3
11
12 /* keyboard Modifiers in boot protocol report */
13 #define BIT_LCTRL (1<<0)
14 #define BIT_LSHIFT (1<<1)
15 #define BIT_LALT (1<<2)
16 #define BIT_LGUI (1<<3)
17 #define BIT_RCTRL (1<<4)
18 #define BIT_RSHIFT (1<<5)
19 #define BIT_RALT (1<<6)
20 #define BIT_RGUI (1<<7)
21 #define BIT_LCTL BIT_LCTRL
22 #define BIT_RCTL BIT_RCTRL
23 #define BIT_LSFT BIT_LSHIFT
24 #define BIT_RSFT BIT_RSHIFT
25
26 /* mouse buttons */
27 #define MOUSE_BTN1 (1<<0)
28 #define MOUSE_BTN2 (1<<1)
29 #define MOUSE_BTN3 (1<<2)
30 #define MOUSE_BTN4 (1<<3)
31 #define MOUSE_BTN5 (1<<4)
32
33 // Consumer Page(0x0C)
34 #define AUDIO_MUTE 0x00E2
35 #define AUDIO_VOL_UP 0x00E9
36 #define AUDIO_VOL_DOWN 0x00EA
37 #define TRANSPORT_NEXT_TRACK 0x00B5
38 #define TRANSPORT_PREV_TRACK 0x00B6
39 #define TRANSPORT_STOP 0x00B7
40 #define TRANSPORT_PLAY_PAUSE 0x00CD
41 #define AL_CC_CONFIG 0x0183
42 #define AL_EMAIL 0x018A
43 #define AL_CALCULATOR 0x0192
44 #define AL_LOCAL_BROWSER 0x0194
45 #define AC_SEARCH 0x0221
46 #define AC_HOME 0x0223
47 #define AC_BACK 0x0224
48 #define AC_FORWARD 0x0225
49 #define AC_STOP 0x0226
50 #define AC_REFRESH 0x0227
51 #define AC_BOOKMARKS 0x022A
52
53 // Generic Desktop Page(0x01)
54 #define SYSTEM_POWER_DOWN 0x0081
55 #define SYSTEM_SLEEP 0x0082
56 #define SYSTEM_WAKE_UP 0x0083
57
58
59 #if defined(HOST_PJRC)
60 # include "usb.h"
61 # if defined(KBD2_REPORT_KEYS) && KBD2_REPORT_KEYS > KBD_REPORT_KEYS
62 # define REPORT_KEYS KBD2_REPORT_KEYS
63 # else
64 # define REPORT_KEYS KBD_REPORT_KEYS
65 # endif
66 #elif defined(HOST_VUSB)
67 # define REPORT_KEYS 6
68 #endif
69
70 typedef struct {
71 uint8_t mods;
72 uint8_t rserved;
73 uint8_t keys[REPORT_KEYS];
74 } report_keyboard_t;
75
76 typedef struct {
77 uint8_t report_id;
78 uint8_t buttons;
79 int8_t x;
80 int8_t y;
81 int8_t v;
82 int8_t h;
83 } report_mouse_t;
84
85
86 #ifdef USB_NKRO_ENABLE
87 extern bool keyboard_nkro;
88 #endif
89
90 extern report_keyboard_t *keyboard_report;
91 extern report_keyboard_t *keyboard_report_prev;
92
93
94 uint8_t host_keyboard_leds(void);
95
96 /* keyboard report operations */
97 void host_add_key(uint8_t key);
98 void host_add_mod_bit(uint8_t mod);
99 void host_set_mods(uint8_t mods);
100 void host_add_code(uint8_t code);
101 void host_swap_keyboard_report(void);
102 void host_clear_keyboard_report(void);
103 uint8_t host_has_anykey(void);
104 uint8_t host_get_first_key(void);
105
106
107 void host_send_keyboard_report(void);
108 #if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE)
109 void host_mouse_send(report_mouse_t *report);
110 #endif
111 #ifdef USB_EXTRA_ENABLE
112 void host_system_send(uint16_t data);
113 void host_consumer_send(uint16_t data);
114 #endif
115
116 #endif
Imprint / Impressum