fix simple pull request comments. Implement descriptor index hack.
This commit is contained in:
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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_ */
|
Reference in New Issue
Block a user