11
11
#include "util/types.h"
12
12
13
13
/* Device descriptor */
14
- const u8 PROGMEM desc_device [] = {
14
+ const u8 __attribute__(( __progmem__ )) desc_device [] = {
15
15
/* clang-format off */
16
16
0x12 , /* LENGTH (18) */
17
17
0x01 , /* DESCRIPTOR TYPE (Device) */
@@ -30,7 +30,7 @@ const u8 PROGMEM desc_device[] = {
30
30
/* clang-format on */
31
31
};
32
32
33
- const u8 PROGMEM oi_rdesc [] = {
33
+ const u8 __attribute__(( __progmem__ )) oi_rdesc [] = {
34
34
/* clang-format off */
35
35
/* short report */
36
36
0x06 , 0x00 , 0xff , /* USAGE_PAGE (Vendor Page) */
@@ -64,7 +64,7 @@ const u8 PROGMEM oi_rdesc[] = {
64
64
};
65
65
66
66
/* HID Mouse report descriptor */
67
- const u8 PROGMEM desc_hid_mouse_report [] = {
67
+ const u8 __attribute__(( __progmem__ )) desc_hid_mouse_report [] = {
68
68
/* clang-format off */
69
69
0x05 , 0x01 , /* USAGE_PAGE (Generic Desktop) */
70
70
0x09 , 0x02 , /* USAGE (Mouse) */
@@ -98,7 +98,7 @@ const u8 PROGMEM desc_hid_mouse_report[] = {
98
98
};
99
99
100
100
/* HID keyboard report descriptor */
101
- const u8 PROGMEM desc_hid_keyboard_report [] = {
101
+ const u8 __attribute__(( __progmem__ )) desc_hid_keyboard_report [] = {
102
102
/* clang-format off */
103
103
0x05 , 0x01 , /* USAGE_PAGE (Generic Desktop) */
104
104
0x09 , 0x06 , /* USAGE (keyboard) */
@@ -142,7 +142,7 @@ const u8 PROGMEM desc_hid_keyboard_report[] = {
142
142
/* clang-format on */
143
143
};
144
144
145
- const u8 PROGMEM oi_hid_desc [] = {
145
+ const u8 __attribute__(( __progmem__ )) oi_hid_desc [] = {
146
146
/* HID */
147
147
0x09 , /* LENGTH */
148
148
0x21 , /* DESCRIPTOR TYPE (hid) */
@@ -155,7 +155,7 @@ const u8 PROGMEM oi_hid_desc[] = {
155
155
0x00 , /* DESCRIPTOR LENGTH () */
156
156
};
157
157
158
- const u8 PROGMEM mouse_hid_desc [] = {
158
+ const u8 __attribute__(( __progmem__ )) mouse_hid_desc [] = {
159
159
/* HID */
160
160
0x09 , /* LENGTH */
161
161
0x21 , /* DESCRIPTOR TYPE (hid) */
@@ -168,7 +168,7 @@ const u8 PROGMEM mouse_hid_desc[] = {
168
168
0x00 , /* DESCRIPTOR LENGTH () */
169
169
};
170
170
171
- const u8 PROGMEM keyboard_hid_desc [] = {
171
+ const u8 __attribute__(( __progmem__ )) keyboard_hid_desc [] = {
172
172
/* HID */
173
173
0x09 , /* LENGTH */
174
174
0x21 , /* DESCRIPTOR TYPE (hid) */
@@ -182,7 +182,7 @@ const u8 PROGMEM keyboard_hid_desc[] = {
182
182
};
183
183
184
184
/* Configuration Descriptor */
185
- const u8 PROGMEM desc_configuration [] = {
185
+ const u8 __attribute__(( __progmem__ )) desc_configuration [] = {
186
186
/* clang-format off */
187
187
/* configuration */
188
188
0x09 , /* LENGTH */
@@ -223,12 +223,11 @@ const u8 PROGMEM desc_configuration[] = {
223
223
/* Endpoint out */
224
224
0x07 , /* LENGTH */
225
225
0x05 , /* DESCRIPTOR TYPE (Endpoint) */
226
- 0x01 , /* ENDPOINT ADDRESS (Endpoint 1 , OUT) */
226
+ 0x02 , /* ENDPOINT ADDRESS (Endpoint 2 , OUT) */
227
227
0x03 , /* ATTRIBUTES (Interrupt) */
228
228
0x40 , 0x00 , /* MAX PACKET SIZE (64) */
229
229
0x0A , /* POLLING INTERVAL (100Hz) */
230
230
231
-
232
231
/* Interface 1 - HID Mouse */
233
232
0x09 , /* LENGTH */
234
233
0x04 , /* DESCRIPTOR TYPE (Interface) */
@@ -251,7 +250,7 @@ const u8 PROGMEM desc_configuration[] = {
251
250
/* Endpoint in */
252
251
0x07 , /* LENGTH */
253
252
0x05 , /* DESCRIPTOR TYPE (Endpoint) */
254
- 0x82 , /* ENDPOINT ADDRESS (Endpoint 2 , IN) */
253
+ 0x83 , /* ENDPOINT ADDRESS (Endpoint 3 , IN) */
255
254
0x03 , /* ATTRIBUTES (Interrupt) */
256
255
0x40 , 0x00 , /* MAX PACKET SIZE (64) */
257
256
0x01 , /* POLLING INTERVAL (1000Hz) */
@@ -279,24 +278,24 @@ const u8 PROGMEM desc_configuration[] = {
279
278
/* Endpoint in */
280
279
0x07 , /* LENGTH */
281
280
0x05 , /* DESCRIPTOR TYPE (Endpoint) */
282
- 0x83 , /* ENDPOINT ADDRESS (Endpoint 3 , IN) */
281
+ 0x84 , /* ENDPOINT ADDRESS (Endpoint 4 , IN) */
283
282
0x03 , /* ATTRIBUTES (Interrupt) */
284
283
0x40 , 0x00 , /* MAX PACKET SIZE (64) */
285
284
0x0A , /* POLLING INTERVAL (100Hz) */
286
285
/* Endpoint out */
287
286
0x07 , /* LENGTH */
288
287
0x05 , /* DESCRIPTOR TYPE (Endpoint) */
289
- 0x03 , /* ENDPOINT ADDRESS (Endpoint 3 , OUT) */
288
+ 0x05 , /* ENDPOINT ADDRESS (Endpoint 5 , OUT) */
290
289
0x03 , /* ATTRIBUTES (Interrupt) */
291
290
0x40 , 0x00 , /* MAX PACKET SIZE (64) */
292
291
0x0A , /* POLLING INTERVAL (100Hz) */
293
292
/* clang-format on */
294
293
};
295
294
296
295
/* String Descriptors */
297
- const USB_Descriptor_String_t PROGMEM lang_str = USB_STRING_DESCRIPTOR_ARRAY (LANGUAGE_ID_ENG );
298
- const USB_Descriptor_String_t PROGMEM manu_str = USB_STRING_DESCRIPTOR (L"Openinput" );
299
- const USB_Descriptor_String_t PROGMEM prod_str = USB_STRING_DESCRIPTOR (L"Openinput Device" );
296
+ const USB_Descriptor_String_t __attribute__(( __progmem__ )) PROGMEM lang_str = USB_STRING_DESCRIPTOR_ARRAY (LANGUAGE_ID_ENG );
297
+ const USB_Descriptor_String_t __attribute__(( __progmem__ )) PROGMEM manu_str = USB_STRING_DESCRIPTOR (L"Openinput" );
298
+ const USB_Descriptor_String_t __attribute__(( __progmem__ )) PROGMEM prod_str = USB_STRING_DESCRIPTOR (L"Openinput Device" );
300
299
301
300
/**
302
301
* This function is called by the library when in device mode, and must be overridden (see LUFA library "USB Descriptors"
@@ -380,20 +379,3 @@ u16 CALLBACK_USB_GetDescriptor(const u16 w_value, const u16 w_index, const void
380
379
* descriptor_address = addr ;
381
380
return size ;
382
381
}
383
-
384
- /** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration
385
- * of the USB device after enumeration, and configures the keyboard and mouse device endpoints.
386
- */
387
- void EVENT_USB_Device_ConfigurationChanged (void )
388
- {
389
- /* Setup Openinput Report Endpoints */
390
- Endpoint_ConfigureEndpoint (0x81 , EP_TYPE_INTERRUPT , 0x40 , 1 ); // IN
391
- Endpoint_ConfigureEndpoint (0x01 , EP_TYPE_INTERRUPT , 0x40 , 1 ); // OUT
392
-
393
- /* Setup Mouse HID Report Endpoint */
394
- Endpoint_ConfigureEndpoint (0x82 , EP_TYPE_INTERRUPT , 0x40 , 1 ); // IN
395
-
396
- /* Setup Keyboard HID Report Endpoints */
397
- Endpoint_ConfigureEndpoint (0x83 , EP_TYPE_INTERRUPT , 0x40 , 1 ); // IN
398
- Endpoint_ConfigureEndpoint (0x03 , EP_TYPE_INTERRUPT , 0x40 , 1 ); // OUT
399
- }
0 commit comments