summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorZachery Littell <[email protected]>2020-10-02 16:02:00 -0500
committerZachery Littell <[email protected]>2020-10-02 16:02:00 -0500
commit081af79009dc40ab41be9976d22629c7d251a50d (patch)
tree9b5b5234b65a158694885b8f338449f2dc7f14a9 /examples
parent34775d909da5de2585821bf31370040d1fbb5f4a (diff)
fix simple pull request comments. Implement descriptor index hack.
Diffstat (limited to 'examples')
-rw-r--r--examples/device/hid_multipleinterface/src/main.c8
-rw-r--r--examples/device/hid_multipleinterface/src/usb_descriptors.c5
-rw-r--r--examples/device/hid_multipleinterface/src/usb_descriptors.h34
3 files changed, 5 insertions, 42 deletions
diff --git a/examples/device/hid_multipleinterface/src/main.c b/examples/device/hid_multipleinterface/src/main.c
index 985d87246..2efb1f5cb 100644
--- a/examples/device/hid_multipleinterface/src/main.c
+++ b/examples/device/hid_multipleinterface/src/main.c
@@ -30,8 +30,6 @@
#include "bsp/board.h"
#include "tusb.h"
-#include "usb_descriptors.h"
-
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF PROTYPES
//--------------------------------------------------------------------+
@@ -138,13 +136,13 @@ void hid_task(void)
uint8_t keycode[6] = { 0 };
keycode[0] = HID_KEY_A;
- tud_hid_n_keyboard_report(keyboard_interface, REPORT_ID_KEYBOARD, 0, keycode);
+ tud_hid_n_keyboard_report(keyboard_interface, 0, 0, keycode);
has_key = true;
}else
{
// send empty key report if previously has key pressed
- if (has_key) tud_hid_n_keyboard_report(keyboard_interface, REPORT_ID_KEYBOARD, 0, NULL);
+ if (has_key) tud_hid_n_keyboard_report(keyboard_interface, 0, 0, NULL);
has_key = false;
}
}
@@ -157,7 +155,7 @@ void hid_task(void)
int8_t const delta = 5;
// no button, right + down, no scroll pan
- tud_hid_n_mouse_report(mouse_interface, REPORT_ID_MOUSE, 0x00, delta, delta, 0, 0);
+ tud_hid_n_mouse_report(mouse_interface, 0, 0x00, delta, delta, 0, 0);
// delay a bit before attempt to send keyboard report
board_delay(10);
diff --git a/examples/device/hid_multipleinterface/src/usb_descriptors.c b/examples/device/hid_multipleinterface/src/usb_descriptors.c
index f8423bdd1..a1a98c773 100644
--- a/examples/device/hid_multipleinterface/src/usb_descriptors.c
+++ b/examples/device/hid_multipleinterface/src/usb_descriptors.c
@@ -24,7 +24,6 @@
*/
#include "tusb.h"
-#include "usb_descriptors.h"
/* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug.
* Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC.
@@ -73,12 +72,12 @@ uint8_t const * tud_descriptor_device_cb(void)
uint8_t const desc_hid_report1[] =
{
- TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(REPORT_ID_KEYBOARD) )
+ TUD_HID_REPORT_DESC_KEYBOARD()
};
uint8_t desc_hid_report2[] =
{
- TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(REPORT_ID_MOUSE) )
+ TUD_HID_REPORT_DESC_MOUSE()
};
// Invoked when received GET HID REPORT DESCRIPTOR
diff --git a/examples/device/hid_multipleinterface/src/usb_descriptors.h b/examples/device/hid_multipleinterface/src/usb_descriptors.h
deleted file mode 100644
index 6992d3349..000000000
--- a/examples/device/hid_multipleinterface/src/usb_descriptors.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Ha Thach (tinyusb.org)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef USB_DESCRIPTORS_H_
-#define USB_DESCRIPTORS_H_
-
-enum
-{
- REPORT_ID_KEYBOARD = 1,
- REPORT_ID_MOUSE
-};
-
-#endif /* USB_DESCRIPTORS_H_ */