]>
git.gir.st - tmk_keyboard.git/blob - host.h
2 Copyright 2011 Jun Wako <wakojun@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #define REPORT_ID_MOUSE 1
26 #define REPORT_ID_SYSTEM 2
27 #define REPORT_ID_CONSUMER 3
29 /* keyboard Modifiers in boot protocol report */
30 #define BIT_LCTRL (1<<0)
31 #define BIT_LSHIFT (1<<1)
32 #define BIT_LALT (1<<2)
33 #define BIT_LGUI (1<<3)
34 #define BIT_RCTRL (1<<4)
35 #define BIT_RSHIFT (1<<5)
36 #define BIT_RALT (1<<6)
37 #define BIT_RGUI (1<<7)
38 #define BIT_LCTL BIT_LCTRL
39 #define BIT_RCTL BIT_RCTRL
40 #define BIT_LSFT BIT_LSHIFT
41 #define BIT_RSFT BIT_RSHIFT
44 #define MOUSE_BTN1 (1<<0)
45 #define MOUSE_BTN2 (1<<1)
46 #define MOUSE_BTN3 (1<<2)
47 #define MOUSE_BTN4 (1<<3)
48 #define MOUSE_BTN5 (1<<4)
50 // Consumer Page(0x0C)
51 #define AUDIO_MUTE 0x00E2
52 #define AUDIO_VOL_UP 0x00E9
53 #define AUDIO_VOL_DOWN 0x00EA
54 #define TRANSPORT_NEXT_TRACK 0x00B5
55 #define TRANSPORT_PREV_TRACK 0x00B6
56 #define TRANSPORT_STOP 0x00B7
57 #define TRANSPORT_PLAY_PAUSE 0x00CD
58 #define AL_CC_CONFIG 0x0183
59 #define AL_EMAIL 0x018A
60 #define AL_CALCULATOR 0x0192
61 #define AL_LOCAL_BROWSER 0x0194
62 #define AC_SEARCH 0x0221
63 #define AC_HOME 0x0223
64 #define AC_BACK 0x0224
65 #define AC_FORWARD 0x0225
66 #define AC_STOP 0x0226
67 #define AC_REFRESH 0x0227
68 #define AC_BOOKMARKS 0x022A
70 // Generic Desktop Page(0x01)
71 #define SYSTEM_POWER_DOWN 0x0081
72 #define SYSTEM_SLEEP 0x0082
73 #define SYSTEM_WAKE_UP 0x0083
76 #if defined(HOST_PJRC)
78 # if defined(KBD2_REPORT_KEYS) && KBD2_REPORT_KEYS > KBD_REPORT_KEYS
79 # define REPORT_KEYS KBD2_REPORT_KEYS
81 # define REPORT_KEYS KBD_REPORT_KEYS
83 #elif defined(HOST_VUSB)
84 # define REPORT_KEYS 6
90 uint8_t keys
[REPORT_KEYS
];
103 #ifdef USB_NKRO_ENABLE
104 extern bool keyboard_nkro
;
107 extern report_keyboard_t
*keyboard_report
;
108 extern report_keyboard_t
*keyboard_report_prev
;
111 uint8_t host_keyboard_leds(void);
113 /* keyboard report operations */
114 void host_add_key(uint8_t key
);
115 void host_add_mod_bit(uint8_t mod
);
116 void host_set_mods(uint8_t mods
);
117 void host_add_code(uint8_t code
);
118 void host_swap_keyboard_report(void);
119 void host_clear_keyboard_report(void);
120 uint8_t host_has_anykey(void);
121 uint8_t host_get_first_key(void);
124 void host_send_keyboard_report(void);
125 #if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE)
126 void host_mouse_send(report_mouse_t
*report
);
128 #ifdef USB_EXTRA_ENABLE
129 void host_system_send(uint16_t data
);
130 void host_consumer_send(uint16_t data
);