mirror of
https://github.com/ArteryTek/AT32F415_Firmware_Library.git
synced 2026-05-21 01:12:20 +00:00
update version to v2.1.6
This commit is contained in:
@@ -74,9 +74,12 @@ static usb_sts_type class_init_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
|
||||
|
||||
/* open hid in endpoint */
|
||||
usbd_ept_open(pudev, USBD_MOUSE_IN_EPT, EPT_INT_TYPE, USBD_MOUSE_IN_MAXPACKET_SIZE);
|
||||
|
||||
pmouse->send_state = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -226,11 +229,13 @@ 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;
|
||||
mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
|
||||
|
||||
/* ...user code...
|
||||
trans next packet data
|
||||
*/
|
||||
|
||||
pmouse->send_state = 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -303,13 +308,15 @@ static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
*/
|
||||
usb_sts_type usb_mouse_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;
|
||||
mouse_type *pmouse = (mouse_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 && pmouse->send_state == 0)
|
||||
{
|
||||
usbd_flush_tx_fifo(pudev, USBD_MOUSE_IN_EPT);
|
||||
pmouse->send_state = 1;
|
||||
usbd_ept_send(pudev, USBD_MOUSE_IN_EPT, report, len);
|
||||
status = USB_OK;
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
@@ -87,6 +87,7 @@ typedef struct
|
||||
uint8_t mouse_buffer[4];
|
||||
uint8_t hid_state;
|
||||
__IO uint8_t hid_suspend_flag;
|
||||
uint8_t send_state;
|
||||
}mouse_type;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user