all hid devices seems to be ok

This commit is contained in:
hathach 2018-07-31 22:54:26 +07:00
parent 2c85f42330
commit 05139e2aee
3 changed files with 10 additions and 4 deletions

View File

@ -41,8 +41,8 @@
#define USB_HID_DEVICE_MOUSE 1
#define USB_HID_DEVICE_CONSUMER 1
#define USB_HID_DEVICE_SYS_CONTROL 1
#define USB_HID_DEVICE_GAMEPAD 0
#define USB_HID_DEVICE_DIGITIZER 0
#define USB_HID_DEVICE_GAMEPAD 1
#define USB_HID_DEVICE_DIGITIZER 0 // not supported yet
enum {
USB_HID_REPORT_ID_UNUSED = 0,
@ -73,7 +73,7 @@ enum {
};
#define USB_HID_NUM_DEVICES (USB_HID_DEVICE_KEYBOARD + USB_HID_DEVICE_MOUSE + USB_HID_DEVICE_CONSUMER + \
USB_HID_REPORT_ID_SYS_CONTROL + USB_HID_DEVICE_GAMEPAD + USB_HID_DEVICE_DIGITIZER )
USB_HID_DEVICE_SYS_CONTROL + USB_HID_DEVICE_GAMEPAD + USB_HID_DEVICE_DIGITIZER )
typedef struct {
mp_obj_base_t base;
@ -85,7 +85,7 @@ typedef struct {
} usb_hid_device_obj_t;
usb_hid_device_obj_t usb_hid_devices[USB_HID_NUM_DEVICES];
extern usb_hid_device_obj_t usb_hid_devices[];
#ifdef __cplusplus
}

View File

@ -36,6 +36,8 @@
#define USB_HID_REPORT_LENGTH_MOUSE 4
#define USB_HID_REPORT_LENGTH_CONSUMER 2
#define USB_HID_REPORT_LENGTH_SYS_CONTROL 1
#define USB_HID_REPORT_LENGTH_GAMEPAD 6
#define USB_HID_REPORT_LENGTH_DIGITIZER 5
#if USB_HID_DEVICE_KEYBOARD
static uint8_t keyboard_report_buffer[USB_HID_REPORT_LENGTH_KEYBOARD];

View File

@ -154,6 +154,10 @@ uint8_t const usb_desc_hid_generic_report[] =
HID_REPORT_DESC_SYSTEM_CONTROL( HID_REPORT_ID(USB_HID_REPORT_ID_SYS_CONTROL ), ),
#endif
#if USB_HID_DEVICE_GAMEPAD
HID_REPORT_DESC_GAMEPAD( HID_REPORT_ID(USB_HID_REPORT_ID_GAMEPAD ), )
#endif
};
//--------------------------------------------------------------------+