|
@@ -112,6 +112,7 @@ static void send_mouse(report_mouse_t *report) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#ifdef EXTRAKEY_ENABLE
|
|
static void send_extra(uint8_t report_id, uint16_t data) {
|
|
static void send_extra(uint8_t report_id, uint16_t data) {
|
|
static uint8_t last_id = 0;
|
|
static uint8_t last_id = 0;
|
|
static uint16_t last_data = 0;
|
|
static uint16_t last_data = 0;
|
|
@@ -124,10 +125,19 @@ static void send_extra(uint8_t report_id, uint16_t data) {
|
|
usbSetInterrupt3((void *)&report, sizeof(report));
|
|
usbSetInterrupt3((void *)&report, sizeof(report));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
-static void send_system(uint16_t data) { send_extra(REPORT_ID_SYSTEM, data); }
|
|
+static void send_system(uint16_t data) {
|
|
|
|
+#ifdef EXTRAKEY_ENABLE
|
|
|
|
+ send_extra(REPORT_ID_SYSTEM, data - SYSTEM_POWER_DOWN + 1);
|
|
|
|
+#endif
|
|
|
|
+}
|
|
|
|
|
|
-static void send_consumer(uint16_t data) { send_extra(REPORT_ID_CONSUMER, data); }
|
|
+static void send_consumer(uint16_t data) {
|
|
|
|
+#ifdef EXTRAKEY_ENABLE
|
|
|
|
+ send_extra(REPORT_ID_CONSUMER, data);
|
|
|
|
+#endif
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
* Request from host *
|
|
* Request from host *
|
|
@@ -200,128 +210,125 @@ uchar usbFunctionWrite(uchar *data, uchar len) {
|
|
* Descriptors *
|
|
* Descriptors *
|
|
*------------------------------------------------------------------*/
|
|
*------------------------------------------------------------------*/
|
|
|
|
|
|
-
|
|
|
|
- * Report Descriptor for keyboard
|
|
|
|
- *
|
|
|
|
- * from an example in HID spec appendix
|
|
|
|
- */
|
|
|
|
const PROGMEM uchar keyboard_hid_report[] = {
|
|
const PROGMEM uchar keyboard_hid_report[] = {
|
|
- 0x05, 0x01,
|
|
+ 0x05, 0x01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+ 0x95, 0x01,
|
|
|
|
+ 0x75, 0x03,
|
|
|
|
+ 0x91, 0x03,
|
|
|
|
+ 0xC0
|
|
};
|
|
};
|
|
|
|
|
|
-
|
|
|
|
- * Report Descriptor for mouse
|
|
|
|
- *
|
|
|
|
- * Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension
|
|
|
|
- * http:
|
|
|
|
- * http:
|
|
|
|
- * http:
|
|
|
|
- */
|
|
|
|
const PROGMEM uchar mouse_hid_report[] = {
|
|
const PROGMEM uchar mouse_hid_report[] = {
|
|
-
|
|
+
|
|
- 0x05, 0x01,
|
|
+ 0x05, 0x01,
|
|
- 0x09, 0x02,
|
|
+ 0x09, 0x02,
|
|
- 0xa1, 0x01,
|
|
+ 0xA1, 0x01,
|
|
- 0x85, REPORT_ID_MOUSE,
|
|
+ 0x85, REPORT_ID_MOUSE,
|
|
- 0x09, 0x01,
|
|
+ 0x09, 0x01,
|
|
- 0xa1, 0x00,
|
|
+ 0xA1, 0x00,
|
|
-
|
|
+
|
|
- 0x05, 0x09,
|
|
+ 0x05, 0x09,
|
|
- 0x19, 0x01,
|
|
+ 0x19, 0x01,
|
|
- 0x29, 0x05,
|
|
+ 0x29, 0x05,
|
|
- 0x15, 0x00,
|
|
+ 0x15, 0x00,
|
|
- 0x25, 0x01,
|
|
+ 0x25, 0x01,
|
|
- 0x75, 0x01,
|
|
+ 0x95, 0x05,
|
|
- 0x95, 0x05,
|
|
+ 0x75, 0x01,
|
|
- 0x81, 0x02,
|
|
+ 0x81, 0x02,
|
|
- 0x75, 0x03,
|
|
+
|
|
- 0x95, 0x01,
|
|
+ 0x95, 0x01,
|
|
- 0x81, 0x03,
|
|
+ 0x75, 0x03,
|
|
-
|
|
+ 0x81, 0x03,
|
|
- 0x05, 0x01,
|
|
+
|
|
- 0x09, 0x30,
|
|
+
|
|
- 0x09, 0x31,
|
|
+ 0x05, 0x01,
|
|
- 0x15, 0x81,
|
|
+ 0x09, 0x30,
|
|
- 0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