|
24 | 24 | * THE SOFTWARE.
|
25 | 25 | */
|
26 | 26 |
|
27 |
| -#include "py/obj.h" |
28 |
| -#include "py/mphal.h" |
29 |
| -#include "py/runtime.h" |
30 |
| - |
31 |
| -#include "genhdr/autogen_usb_descriptor.h" |
32 |
| -#include "shared-module/usb_hid/Device.h" |
33 |
| -#include "shared-bindings/usb_hid/Device.h" |
34 |
| -#include "tusb.h" |
35 |
| - |
36 |
| -#ifdef USB_HID_REPORT_ID_KEYBOARD |
37 |
| -static uint8_t keyboard_report_buffer[USB_HID_REPORT_LENGTH_KEYBOARD]; |
38 |
| -#endif |
39 |
| - |
40 |
| -#ifdef USB_HID_REPORT_ID_MOUSE |
41 |
| -static uint8_t mouse_report_buffer[USB_HID_REPORT_LENGTH_MOUSE]; |
42 |
| -#endif |
43 |
| - |
44 |
| -#ifdef USB_HID_REPORT_ID_CONSUMER |
45 |
| -static uint8_t consumer_report_buffer[USB_HID_REPORT_LENGTH_CONSUMER]; |
46 |
| -#endif |
47 |
| - |
48 |
| -#ifdef USB_HID_REPORT_ID_SYS_CONTROL |
49 |
| -static uint8_t sys_control_report_buffer[USB_HID_REPORT_LENGTH_SYS_CONTROL]; |
50 |
| -#endif |
51 |
| - |
52 |
| -#ifdef USB_HID_REPORT_ID_GAMEPAD |
53 |
| -static uint8_t gamepad_report_buffer[USB_HID_REPORT_LENGTH_GAMEPAD]; |
54 |
| -#endif |
55 |
| - |
56 |
| -#ifdef USB_HID_REPORT_ID_DIGITIZER |
57 |
| -static uint8_t digitizer_report_buffer[USB_HID_REPORT_LENGTH_DIGITIZER]; |
58 |
| -#endif |
59 |
| - |
60 |
| -usb_hid_device_obj_t usb_hid_devices[] = { |
61 |
| -#ifdef USB_HID_REPORT_ID_KEYBOARD |
62 |
| - { |
63 |
| - .base = { .type = &usb_hid_device_type } , |
64 |
| - .report_buffer = keyboard_report_buffer , |
65 |
| - .report_id = USB_HID_REPORT_ID_KEYBOARD , |
66 |
| - .report_length = USB_HID_REPORT_LENGTH_KEYBOARD , |
67 |
| - .usage_page = HID_USAGE_PAGE_DESKTOP , |
68 |
| - .usage = HID_USAGE_DESKTOP_KEYBOARD , |
69 |
| - }, |
70 |
| -#endif |
71 |
| - |
72 |
| -#ifdef USB_HID_REPORT_ID_MOUSE |
73 |
| - { |
74 |
| - .base = { .type = &usb_hid_device_type } , |
75 |
| - .report_buffer = mouse_report_buffer , |
76 |
| - .report_id = USB_HID_REPORT_ID_MOUSE , |
77 |
| - .report_length = USB_HID_REPORT_LENGTH_MOUSE , |
78 |
| - .usage_page = HID_USAGE_PAGE_DESKTOP , |
79 |
| - .usage = HID_USAGE_DESKTOP_MOUSE , |
80 |
| - }, |
81 |
| -#endif |
82 |
| - |
83 |
| -#ifdef USB_HID_REPORT_ID_CONSUMER |
84 |
| - { |
85 |
| - .base = { .type = &usb_hid_device_type } , |
86 |
| - .report_buffer = consumer_report_buffer , |
87 |
| - .report_id = USB_HID_REPORT_ID_CONSUMER , |
88 |
| - .report_length = USB_HID_REPORT_LENGTH_CONSUMER , |
89 |
| - .usage_page = HID_USAGE_PAGE_CONSUMER , |
90 |
| - .usage = HID_USAGE_CONSUMER_CONTROL , |
91 |
| - }, |
92 |
| -#endif |
93 |
| - |
94 |
| -#ifdef USB_HID_REPORT_ID_SYS_CONTROL |
95 |
| - { |
96 |
| - .base = { .type = &usb_hid_device_type } , |
97 |
| - .report_buffer = sys_control_report_buffer , |
98 |
| - .report_id = USB_HID_REPORT_ID_SYS_CONTROL , |
99 |
| - .report_length = USB_HID_REPORT_LENGTH_SYS_CONTROL , |
100 |
| - .usage_page = HID_USAGE_PAGE_DESKTOP , |
101 |
| - .usage = HID_USAGE_DESKTOP_SYSTEM_CONTROL , |
102 |
| - }, |
103 |
| -#endif |
104 |
| - |
105 |
| -#ifdef USB_HID_REPORT_ID_GAMEPAD |
106 |
| - { |
107 |
| - .base = { .type = &usb_hid_device_type } , |
108 |
| - .report_buffer = gamepad_report_buffer , |
109 |
| - .report_id = USB_HID_REPORT_ID_GAMEPAD , |
110 |
| - .report_length = USB_HID_REPORT_LENGTH_GAMEPAD , |
111 |
| - .usage_page = HID_USAGE_PAGE_DESKTOP , |
112 |
| - .usage = HID_USAGE_DESKTOP_GAMEPAD , |
113 |
| - }, |
114 |
| -#endif |
115 |
| - |
116 |
| -#ifdef USB_HID_REPORT_ID_DIGITIZER |
117 |
| - { |
118 |
| - .base = { .type = &usb_hid_device_type } , |
119 |
| - .report_buffer = digitizer_report_buffer , |
120 |
| - .report_id = USB_HID_REPORT_ID_DIGITIZER , |
121 |
| - .report_length = USB_HID_REPORT_LENGTH_DIGITIZER , |
122 |
| - .usage_page = 0x0D , |
123 |
| - .usage = 0x02 , |
124 |
| - }, |
125 |
| -#endif |
126 |
| -}; |
127 |
| - |
128 |
| - |
129 |
| -mp_obj_tuple_t common_hal_usb_hid_devices = { |
130 |
| - .base = { |
131 |
| - .type = &mp_type_tuple, |
132 |
| - }, |
133 |
| - .len = USB_HID_NUM_DEVICES, |
134 |
| - .items = { |
135 |
| -#if USB_HID_NUM_DEVICES >= 1 |
136 |
| - (mp_obj_t) &usb_hid_devices[0], |
137 |
| -#endif |
138 |
| -#if USB_HID_NUM_DEVICES >= 2 |
139 |
| - (mp_obj_t) &usb_hid_devices[1], |
140 |
| -#endif |
141 |
| -#if USB_HID_NUM_DEVICES >= 3 |
142 |
| - (mp_obj_t) &usb_hid_devices[2], |
143 |
| -#endif |
144 |
| -#if USB_HID_NUM_DEVICES >= 4 |
145 |
| - (mp_obj_t) &usb_hid_devices[3], |
146 |
| -#endif |
147 |
| -#if USB_HID_NUM_DEVICES >= 5 |
148 |
| - (mp_obj_t) &usb_hid_devices[4], |
149 |
| -#endif |
150 |
| -#if USB_HID_NUM_DEVICES >= 6 |
151 |
| - (mp_obj_t) &usb_hid_devices[5], |
152 |
| -#endif |
153 |
| - } |
154 |
| -}; |
| 27 | +// Nothing needed here. Tables of HID devices are generated in autogen_usb_descriptor.c at compile-time. |
0 commit comments