stmhal/usb: Use correct ClassData structure for HID receive.

This commit is contained in:
Pavol Rusnak 2016-09-22 21:39:50 +02:00 committed by Damien George
parent eb239b8398
commit 8f3cf6e6a8
2 changed files with 4 additions and 3 deletions

View File

@ -47,12 +47,11 @@
static __IO uint8_t dev_is_connected = 0; // indicates if we are connected
static uint8_t buffer[2][64]; // pair of buffers to read individual packets into
static uint8_t buffer[2][HID_DATA_FS_MAX_PACKET_SIZE]; // pair of buffers to read individual packets into
static int8_t current_read_buffer = 0; // which buffer to read from
static uint32_t last_read_len; // length of last read
static int8_t current_write_buffer = 0; // which buffer to write to
static size_t rx_packet_size = 64; // expected size of packets to receive
/* Private function prototypes -----------------------------------------------*/
static int8_t HID_Itf_Receive (uint8_t* pbuf, uint32_t Len);

View File

@ -53,6 +53,7 @@
#define HID_IN_EP_WITH_CDC (0x81)
#define HID_OUT_EP_WITH_CDC (0x01)
#define HID_IN_EP_WITH_MSC (0x83)
#define HID_OUT_EP_WITH_MSC (0x03)
#define USB_DESC_TYPE_ASSOCIATION (0x0b)
@ -613,6 +614,7 @@ int USBD_SelectMode(uint32_t mode, USBD_HID_ModeInfoTypeDef *hid_info) {
// not implemented
case USBD_MODE_MSC_HID:
hid_in_ep = HID_IN_EP_WITH_MSC;
hid_out_ep = HID_OUT_EP_WITH_MSC;
hid_iface_num = HID_IFACE_NUM_WITH_MSC;
break;
*/
@ -723,7 +725,7 @@ static uint8_t USBD_CDC_MSC_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) {
mps_out);
// Prepare Out endpoint to receive next packet
USBD_LL_PrepareReceive(pdev, hid_out_ep, CDC_ClassData.RxBuffer, mps_out);
USBD_LL_PrepareReceive(pdev, hid_out_ep, HID_ClassData.RxBuffer, mps_out);
HID_ClassData.state = HID_IDLE;
}