mirror of
https://github.com/ArteryTek/AT32F415_Firmware_Library.git
synced 2026-05-21 09:22:11 +00:00
update version to v2.1.6
This commit is contained in:
@@ -85,6 +85,8 @@ static usb_sts_type class_init_handler(void *udev)
|
||||
/* set out endpoint to receive status */
|
||||
usbd_ept_recv(pudev, USBD_CUSTOM_HID_OUT_EPT, pcshid->g_rxhid_buff, USBD_CUSTOM_OUT_MAXPACKET_SIZE);
|
||||
|
||||
pcshid->send_state = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -240,7 +242,11 @@ static usb_sts_type class_ept0_rx_handler(void *udev)
|
||||
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
|
||||
|
||||
pcshid->send_state = 0;
|
||||
|
||||
/* ...user code...
|
||||
trans next packet data
|
||||
*/
|
||||
@@ -326,12 +332,16 @@ static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
*/
|
||||
usb_sts_type custom_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usb_sts_type status = USB_FAIL;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
|
||||
|
||||
if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED)
|
||||
if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED && pcshid->send_state == 0)
|
||||
{
|
||||
pcshid->send_state = 1;
|
||||
usbd_ept_send(pudev, USBD_CUSTOM_HID_IN_EPT, report, len);
|
||||
|
||||
status = USB_OK;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -385,7 +395,7 @@ static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len)
|
||||
{
|
||||
pcshid->g_txhid_buff[i_index] = report[i_index];
|
||||
}
|
||||
usbd_ept_send(pudev, USBD_CUSTOM_HID_IN_EPT, pcshid->g_txhid_buff, len);
|
||||
custom_hid_class_send_report(pudev, pcshid->g_txhid_buff, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -77,6 +77,7 @@ typedef struct
|
||||
uint8_t hid_set_report[64];
|
||||
uint8_t hid_get_report[64];
|
||||
uint8_t hid_state;
|
||||
uint8_t send_state;
|
||||
}custom_hid_type;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user