|
|
@@ -172,6 +172,12 @@ static const uint8_t hid_keyboard_report_desc[HID_KEYBOARD_REPORT_DESC_SIZE] = {
|
|
|
0xc0 // END_COLLECTION
|
|
|
};
|
|
|
|
|
|
+#define HID_STATE_IDLE 0
|
|
|
+#define HID_STATE_BUSY 1
|
|
|
+
|
|
|
+/*!< hid state ! Data can be sent only when state is idle */
|
|
|
+static volatile uint8_t hid_state = HID_STATE_IDLE;
|
|
|
+
|
|
|
static void usbd_event_handler(uint8_t busid, uint8_t event)
|
|
|
{
|
|
|
switch (event) {
|
|
|
@@ -186,6 +192,7 @@ static void usbd_event_handler(uint8_t busid, uint8_t event)
|
|
|
case USBD_EVENT_SUSPEND:
|
|
|
break;
|
|
|
case USBD_EVENT_CONFIGURED:
|
|
|
+ hid_state = HID_STATE_IDLE;
|
|
|
break;
|
|
|
case USBD_EVENT_SET_REMOTE_WAKEUP:
|
|
|
break;
|
|
|
@@ -197,12 +204,6 @@ static void usbd_event_handler(uint8_t busid, uint8_t event)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#define HID_STATE_IDLE 0
|
|
|
-#define HID_STATE_BUSY 1
|
|
|
-
|
|
|
-/*!< hid state ! Data can be sent only when state is idle */
|
|
|
-static volatile uint8_t hid_state = HID_STATE_IDLE;
|
|
|
-
|
|
|
void usbd_hid_int_callback(uint8_t busid, uint8_t ep, uint32_t nbytes)
|
|
|
{
|
|
|
hid_state = HID_STATE_IDLE;
|