]>
git.gir.st - tmk_keyboard.git/blob - common/report.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/>.
26 #define REPORT_ID_MOUSE 1
27 #define REPORT_ID_SYSTEM 2
28 #define REPORT_ID_CONSUMER 3
31 #define MOUSE_BTN1 (1<<0)
32 #define MOUSE_BTN2 (1<<1)
33 #define MOUSE_BTN3 (1<<2)
34 #define MOUSE_BTN4 (1<<3)
35 #define MOUSE_BTN5 (1<<4)
37 // Consumer Page(0x0C)
38 // following are supported by Windows: http://msdn.microsoft.com/en-us/windows/hardware/gg463372.aspx
39 #define AUDIO_MUTE 0x00E2
40 #define AUDIO_VOL_UP 0x00E9
41 #define AUDIO_VOL_DOWN 0x00EA
42 #define TRANSPORT_NEXT_TRACK 0x00B5
43 #define TRANSPORT_PREV_TRACK 0x00B6
44 #define TRANSPORT_STOP 0x00B7
45 #define TRANSPORT_PLAY_PAUSE 0x00CD
46 #define AL_CC_CONFIG 0x0183
47 #define AL_EMAIL 0x018A
48 #define AL_CALCULATOR 0x0192
49 #define AL_LOCAL_BROWSER 0x0194
50 #define AC_SEARCH 0x0221
51 #define AC_HOME 0x0223
52 #define AC_BACK 0x0224
53 #define AC_FORWARD 0x0225
54 #define AC_STOP 0x0226
55 #define AC_REFRESH 0x0227
56 #define AC_BOOKMARKS 0x022A
57 // supplement for Bluegiga iWRAP HID(not supported by Windows?)
58 #define AL_LOCK 0x019E
59 #define TRANSPORT_RECORD 0x00B2
60 #define TRANSPORT_REWIND 0x00B4
61 #define TRANSPORT_EJECT 0x00B8
62 #define AC_MINIMIZE 0x0206
64 // Generic Desktop Page(0x01)
65 #define SYSTEM_POWER_DOWN 0x0081
66 #define SYSTEM_SLEEP 0x0082
67 #define SYSTEM_WAKE_UP 0x0083
70 // key report size(NKRO or boot mode)
71 #if defined(HOST_PJRC)
73 # if defined(KBD2_REPORT_KEYS) && KBD2_REPORT_KEYS > KBD_REPORT_KEYS
74 # define REPORT_KEYS KBD2_REPORT_KEYS
76 # define REPORT_KEYS KBD_REPORT_KEYS
79 # define REPORT_KEYS 6
90 uint8_t keys
[REPORT_KEYS
];
91 } __attribute__ ((packed
)) report_keyboard_t
;
99 } __attribute__ ((packed
)) report_mouse_t
;
102 static uint16_t key2system(uint8_t key
)
106 case KC_SYSTEM_POWER
:
107 usage
= SYSTEM_POWER_DOWN
;
109 case KC_SYSTEM_SLEEP
:
110 usage
= SYSTEM_SLEEP
;
113 usage
= SYSTEM_WAKE_UP
;
119 static uint16_t key2consumer(uint8_t key
)
126 case KC_AUDIO_VOL_UP
:
127 usage
= AUDIO_VOL_UP
;
129 case KC_AUDIO_VOL_DOWN
:
130 usage
= AUDIO_VOL_DOWN
;
132 case KC_MEDIA_NEXT_TRACK
:
133 usage
= TRANSPORT_NEXT_TRACK
;
135 case KC_MEDIA_PREV_TRACK
:
136 usage
= TRANSPORT_PREV_TRACK
;
139 usage
= TRANSPORT_STOP
;
141 case KC_MEDIA_PLAY_PAUSE
:
142 usage
= TRANSPORT_PLAY_PAUSE
;
144 case KC_MEDIA_SELECT
:
145 usage
= AL_CC_CONFIG
;
151 usage
= AL_CALCULATOR
;
154 usage
= AL_LOCAL_BROWSER
;
174 case KC_WWW_FAVORITES
:
175 usage
= AC_BOOKMARKS
;