16
16
#define USB_PID 0xbeef
17
17
#endif
18
18
19
- // TODO: replace usage / rename
20
- #define REPORT_TYPE_OUTPUT 2
21
- #define REPORT_TYPE_FEATURE 3
22
-
23
- #define DEVICE_TYPE 0
24
- #define INTERFACE_TYPE 1
25
- #define ENDPOINT_TYPE 2
26
-
27
19
// EP0 States
28
20
#define NEW_SETUP_PHASE 0x00
29
21
#define IN0_DATA_PHASE 0x01
34
26
#define OUT0_KeyMode_PHASE 0x0a
35
27
#define OUT0_ISP_PHASE 0x05
36
28
37
- /* interface */
29
+ // interface
38
30
#define interface0_PHASE 0x00
39
31
#define interface1_PHASE 0x01
40
32
75
67
#define IEP0CNT_SET (COUNT ) \
76
68
do { IEP0CNT_CLR; IEP0CNT |= COUNT; } while (0)
77
69
78
- enum {
79
- REPORT_ID_ACPI = 0x01 ,
80
- REPORT_ID_CONSUMER = 0x02 ,
81
- REPORT_ID_ISP = 0x05 ,
82
- REPORT_ID_NKRO = 0x06
83
- };
84
-
85
70
const uint8_t hid_report_desc_keyboard [] = {
86
71
// *INDENT-OFF*
87
72
HID_RI_USAGE_PAGE (8 , 0x01 ), // Generic Desktop Controls
@@ -303,10 +288,17 @@ static usb_desc_langid_c usb_langid = {
303
288
.wLANGID = { /* English (United States) */ 0x0409 },
304
289
};
305
290
291
+ enum usb_string_index {
292
+ USB_STRING_LANGUAGE_ID = 0 ,
293
+ USB_STRING_MANUFACTURER = 1 ,
294
+ USB_STRING_PRODUCT = 2 ,
295
+ USB_STRING_SERIAL_NUMBER = 3 ,
296
+ };
297
+
306
298
usb_ascii_string_c usb_strings [] = {
307
299
[
USB_STRING_MANUFACTURER - 1 ]
= "[email protected] " ,
308
300
[USB_STRING_PRODUCT - 1 ] = "SMK Keyboard" ,
309
- [USB_STRING_SERIAL_NUMBER - 1 ] = "0001" // TODO: include this
301
+ [USB_STRING_SERIAL_NUMBER - 1 ] = "0001"
310
302
};
311
303
312
304
usb_descriptor_set_c usb_descriptor_set = {
@@ -317,6 +309,13 @@ usb_descriptor_set_c usb_descriptor_set = {
317
309
.strings = usb_strings ,
318
310
};
319
311
312
+ enum report_id {
313
+ REPORT_ID_ACPI = 1 ,
314
+ REPORT_ID_CONSUMER = 2 ,
315
+ REPORT_ID_ISP = 5 ,
316
+ REPORT_ID_NKRO = 6 ,
317
+ };
318
+
320
319
// interrupt handlers
321
320
static void usb_setup_irq ();
322
321
static void usb_ep0_out_irq ();
@@ -370,7 +369,6 @@ volatile __bit device_remote_wakeup_f;
370
369
volatile uint8_t __xdata configution_value ;
371
370
372
371
uint8_t __xdata EP1_IDLE_TIME ;
373
- uint8_t __xdata EP1_IDLE_COUNT ;
374
372
375
373
uint8_t __xdata ep0_xfer_state ;
376
374
@@ -990,8 +988,8 @@ static void usb_hid_set_report_handler(__xdata struct usb_req_setup *req)
990
988
991
989
static void usb_hid_set_idle_handler (__xdata struct usb_req_setup * req )
992
990
{
993
- // TODO: is this used?
994
- EP1_IDLE_TIME = EP1_IDLE_COUNT = req -> wValue >> 8 ;
991
+ // TODO: finish implementaiton to use the set idle time
992
+ EP1_IDLE_TIME = req -> wValue >> 8 ;
995
993
996
994
IEP0CNT_CLR ;
997
995
IN0_SET_READY ;
0 commit comments