aboutsummaryrefslogtreecommitdiff
path: root/host.h
diff options
context:
space:
mode:
Diffstat (limited to 'host.h')
-rw-r--r--host.h89
1 files changed, 5 insertions, 84 deletions
diff --git a/host.h b/host.h
index bdbd7db05..06f1311ab 100644
--- a/host.h
+++ b/host.h
@@ -19,88 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19#define HOST_H 19#define HOST_H
20 20
21#include <stdint.h> 21#include <stdint.h>
22#include "report.h"
23#include "host_driver.h"
22 24
23 25
24/* report id */ 26#ifdef NKRO_ENABLE
25#define REPORT_ID_MOUSE 1
26#define REPORT_ID_SYSTEM 2
27#define REPORT_ID_CONSUMER 3
28
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
42
43/* mouse buttons */
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)
49
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
69
70// Generic Desktop Page(0x01)
71#define SYSTEM_POWER_DOWN 0x0081
72#define SYSTEM_SLEEP 0x0082
73#define SYSTEM_WAKE_UP 0x0083
74
75
76#if defined(HOST_PJRC)
77# include "usb.h"
78# if defined(KBD2_REPORT_KEYS) && KBD2_REPORT_KEYS > KBD_REPORT_KEYS
79# define REPORT_KEYS KBD2_REPORT_KEYS
80# else
81# define REPORT_KEYS KBD_REPORT_KEYS
82# endif
83#elif defined(HOST_VUSB)
84# define REPORT_KEYS 6
85#endif
86
87typedef struct {
88 uint8_t mods;
89 uint8_t rserved;
90 uint8_t keys[REPORT_KEYS];
91} report_keyboard_t;
92
93typedef struct {
94 uint8_t report_id;
95 uint8_t buttons;
96 int8_t x;
97 int8_t y;
98 int8_t v;
99 int8_t h;
100} report_mouse_t;
101
102
103#ifdef USB_NKRO_ENABLE
104extern bool keyboard_nkro; 27extern bool keyboard_nkro;
105#endif 28#endif
106 29
@@ -108,6 +31,8 @@ extern report_keyboard_t *keyboard_report;
108extern report_keyboard_t *keyboard_report_prev; 31extern report_keyboard_t *keyboard_report_prev;
109 32
110 33
34void host_set_driver(host_driver_t *driver);
35host_driver_t *host_get_driver(void);
111uint8_t host_keyboard_leds(void); 36uint8_t host_keyboard_leds(void);
112 37
113/* keyboard report operations */ 38/* keyboard report operations */
@@ -122,12 +47,8 @@ uint8_t host_get_first_key(void);
122 47
123 48
124void host_send_keyboard_report(void); 49void host_send_keyboard_report(void);
125#if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE)
126void host_mouse_send(report_mouse_t *report); 50void host_mouse_send(report_mouse_t *report);
127#endif
128#ifdef USB_EXTRA_ENABLE
129void host_system_send(uint16_t data); 51void host_system_send(uint16_t data);
130void host_consumer_send(uint16_t data); 52void host_consumer_send(uint16_t data);
131#endif
132 53
133#endif 54#endif