diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-09-03 14:44:46 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-09-03 14:44:46 -0400 |
| commit | 42f5edbd331b27c7096f57da2affd7561287c17f (patch) | |
| tree | a7d86861f2b2e64ea673ec658f503eb8857d15e8 /shared-module | |
| parent | 1d973a08038148ce20aaa43863721df6328318b7 (diff) | |
WIP
Diffstat (limited to 'shared-module')
| -rw-r--r-- | shared-module/usb_hid/Device.c | 4 | ||||
| -rw-r--r-- | shared-module/usb_hid/__init__.c | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/shared-module/usb_hid/Device.c b/shared-module/usb_hid/Device.c index 26d70cb82..bed7d163f 100644 --- a/shared-module/usb_hid/Device.c +++ b/shared-module/usb_hid/Device.c @@ -48,9 +48,7 @@ void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t* // Wait until interface is ready, timeout = 2 seconds uint64_t end_ticks = ticks_ms + 2000; while ( (ticks_ms < end_ticks) && !tud_hid_ready() ) { -#ifdef MICROPY_VM_HOOK_LOOP - MICROPY_VM_HOOK_LOOP; -#endif + RUN_BACKGROUND_TASKS; } if ( !tud_hid_ready() ) { diff --git a/shared-module/usb_hid/__init__.c b/shared-module/usb_hid/__init__.c index f14fdd41e..3ce26a1a1 100644 --- a/shared-module/usb_hid/__init__.c +++ b/shared-module/usb_hid/__init__.c @@ -53,6 +53,10 @@ static uint8_t sys_control_report_buffer[USB_HID_REPORT_LENGTH_SYS_CONTROL]; static uint8_t gamepad_report_buffer[USB_HID_REPORT_LENGTH_GAMEPAD]; #endif +#ifdef USB_HID_REPORT_ID_XAC_COMPATIBLE_GAMEPAD +static uint8_t xac_compatible_gamepad_report_buffer[USB_HID_REPORT_LENGTH_XAC_COMPATIBLE_GAMEPAD]; +#endif + #ifdef USB_HID_REPORT_ID_DIGITIZER static uint8_t digitizer_report_buffer[USB_HID_REPORT_LENGTH_DIGITIZER]; #endif @@ -113,6 +117,17 @@ usb_hid_device_obj_t usb_hid_devices[] = { }, #endif +#ifdef USB_HID_REPORT_ID_XAC_COMPATIBLE_GAMEPAD + { + .base = { .type = &usb_hid_device_type } , + .report_buffer = xac_compatible_gamepad_report_buffer , + .report_id = USB_HID_REPORT_ID_XAC_COMPATIBLE_GAMEPAD , + .report_length = USB_HID_REPORT_LENGTH_XAC_COMPATIBLE_GAMEPAD , + .usage_page = HID_USAGE_PAGE_DESKTOP , + .usage = HID_USAGE_DESKTOP_GAMEPAD , + }, +#endif + #ifdef USB_HID_REPORT_ID_DIGITIZER { .base = { .type = &usb_hid_device_type } , @@ -150,5 +165,8 @@ mp_obj_tuple_t common_hal_usb_hid_devices = { #if USB_HID_NUM_DEVICES >= 6 (mp_obj_t) &usb_hid_devices[5], #endif +#if USB_HID_NUM_DEVICES >= 7 +#error "Too many USB HID devices" +#endif } }; |
