compile new class
This commit is contained in:
parent
0ff9870612
commit
4fad28ea47
8
targets/stm32l432/lib/usbd/usbd_ccid.h
Normal file
8
targets/stm32l432/lib/usbd/usbd_ccid.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef _USBD_H_
|
||||||
|
#define _USBD_H_
|
||||||
|
|
||||||
|
#define CCID_IN_EP 0x84U /* EP1 for data IN */
|
||||||
|
#define CCID_OUT_EP 0x04U /* EP1 for data OUT */
|
||||||
|
#define CCID_CMD_EP 0x85U /* EP2 for CDC commands */
|
||||||
|
|
||||||
|
#endif
|
@ -2,6 +2,7 @@
|
|||||||
#include "usbd_desc.h"
|
#include "usbd_desc.h"
|
||||||
#include "usbd_hid.h"
|
#include "usbd_hid.h"
|
||||||
#include "usbd_cdc.h"
|
#include "usbd_cdc.h"
|
||||||
|
#include "usbd_ccid.h"
|
||||||
#include "usbd_ctlreq.h"
|
#include "usbd_ctlreq.h"
|
||||||
|
|
||||||
static uint8_t USBD_Composite_Init (USBD_HandleTypeDef *pdev, uint8_t cfgidx);
|
static uint8_t USBD_Composite_Init (USBD_HandleTypeDef *pdev, uint8_t cfgidx);
|
||||||
@ -29,8 +30,8 @@ static uint8_t *USBD_Composite_GetDeviceQualifierDescriptor (uint16_t *length);
|
|||||||
#define NUM_INTERFACES 3
|
#define NUM_INTERFACES 3
|
||||||
|
|
||||||
#if NUM_INTERFACES>2
|
#if NUM_INTERFACES>2
|
||||||
#define COMPOSITE_CDC_HID_DESCRIPTOR_SIZE (90)
|
#define COMPOSITE_CDC_HID_DESCRIPTOR_SIZE (90 + 84)
|
||||||
#if NUM_INTERFACES>1
|
#elif NUM_INTERFACES>1
|
||||||
#define COMPOSITE_CDC_HID_DESCRIPTOR_SIZE (90)
|
#define COMPOSITE_CDC_HID_DESCRIPTOR_SIZE (90)
|
||||||
#else
|
#else
|
||||||
#define COMPOSITE_CDC_HID_DESCRIPTOR_SIZE (41)
|
#define COMPOSITE_CDC_HID_DESCRIPTOR_SIZE (41)
|
||||||
@ -224,21 +225,21 @@ USB_DESC_TYPE_INTERFACE, /* bDescriptorType: Interface */
|
|||||||
/*Endpoint IN1 Descriptor*/
|
/*Endpoint IN1 Descriptor*/
|
||||||
7, /* bLength: Endpoint Descriptor size */
|
7, /* bLength: Endpoint Descriptor size */
|
||||||
USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */
|
USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */
|
||||||
0x81, /* bEndpointAddress: (IN1) */
|
CCID_IN_EP, /* bEndpointAddress: (IN1) */
|
||||||
0x02, /* bmAttributes: Bulk */
|
0x02, /* bmAttributes: Bulk */
|
||||||
HID_FIDO_REPORT_DESC_SIZE, 0x00, /* wMaxPacketSize: */
|
HID_FIDO_REPORT_DESC_SIZE, 0x00, /* wMaxPacketSize: */
|
||||||
0x00, /* bInterval */
|
0x00, /* bInterval */
|
||||||
/*Endpoint OUT1 Descriptor*/
|
/*Endpoint OUT1 Descriptor*/
|
||||||
7, /* bLength: Endpoint Descriptor size */
|
7, /* bLength: Endpoint Descriptor size */
|
||||||
USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */
|
USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */
|
||||||
0x01, /* bEndpointAddress: (OUT1) */
|
CCID_OUT_EP, /* bEndpointAddress: (OUT1) */
|
||||||
0x02, /* bmAttributes: Bulk */
|
0x02, /* bmAttributes: Bulk */
|
||||||
HID_FIDO_REPORT_DESC_SIZE, 0x00, /* wMaxPacketSize: */
|
HID_FIDO_REPORT_DESC_SIZE, 0x00, /* wMaxPacketSize: */
|
||||||
0x00, /* bInterval */
|
0x00, /* bInterval */
|
||||||
/*Endpoint IN2 Descriptor*/
|
/*Endpoint IN2 Descriptor*/
|
||||||
7, /* bLength: Endpoint Descriptor size */
|
7, /* bLength: Endpoint Descriptor size */
|
||||||
USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */
|
USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */
|
||||||
0x82, /* bEndpointAddress: (IN2) */
|
CCID_CMD_EP, /* bEndpointAddress: (IN2) */
|
||||||
0x03, /* bmAttributes: Interrupt */
|
0x03, /* bmAttributes: Interrupt */
|
||||||
0x04, 0x00, /* wMaxPacketSize: 4 */
|
0x04, 0x00, /* wMaxPacketSize: 4 */
|
||||||
0xFF, /* bInterval (255ms) */
|
0xFF, /* bInterval (255ms) */
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
#include "stm32l4xx_hal.h"
|
#include "stm32l4xx_hal.h"
|
||||||
#include "usbd_core.h"
|
#include "usbd_core.h"
|
||||||
#include "usbd_hid.h"
|
#include "usbd_hid.h"
|
||||||
|
#include "usbd_cdc.h"
|
||||||
|
#include "usbd_ccid.h"
|
||||||
|
|
||||||
void SystemClock_Config(void);
|
void SystemClock_Config(void);
|
||||||
|
|
||||||
@ -252,14 +254,18 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
|
|||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);
|
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);
|
||||||
|
|
||||||
// HID
|
// HID
|
||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x01 , PCD_SNG_BUF, 0x98);
|
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , HID_EPOUT_ADDR , PCD_SNG_BUF, 0x98);
|
||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x81 , PCD_SNG_BUF, 0xd8);
|
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , HID_EPIN_ADDR , PCD_SNG_BUF, 0xd8);
|
||||||
|
|
||||||
// CDC / uart
|
// CDC / uart
|
||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x02 , PCD_SNG_BUF, 0xd8 + 64); // data OUT
|
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , CDC_OUT_EP , PCD_SNG_BUF, 0xd8 + 64); // data OUT
|
||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x82 , PCD_SNG_BUF, 0xd8 + 64*2); // data IN
|
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , CDC_IN_EP , PCD_SNG_BUF, 0xd8 + 64*2); // data IN
|
||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x83 , PCD_SNG_BUF, 0xd8 + 64*3); // commands
|
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , CDC_CMD_EP , PCD_SNG_BUF, 0xd8 + 64*3); // commands
|
||||||
|
|
||||||
|
// CCID
|
||||||
|
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , CCID_OUT_EP , PCD_SNG_BUF, 0xd8 + 64*4); // data OUT
|
||||||
|
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , CCID_IN_EP , PCD_SNG_BUF, 0xd8 + 64*5); // data IN
|
||||||
|
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , CCID_CMD_EP , PCD_SNG_BUF, 0xd8 + 64*6); // commands
|
||||||
|
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user