要实现Method 1支持的静态图像捕获功能,你需要进行以下步骤:
1. 在cyfxuvcdscr.h文件中,添加一个新的bUnitEnable成员,用于设置是否启用新的功能。例如:
```cpp
uint8_t bUnitEnable; /* Enable/disable this unit. */
```
2. 在cyfxuvcdscr.c文件中,修改Device Descriptor的定义,使其支持新的功能。例如:
```cpp
/* Device Descriptor */
const uint8_t CyFxUVCDscr[] __attribute__ ((aligned (32))) =
{
0x12, /* Descriptor size */
CY_U3P_USB_DEVICE_DESCR, /* Device descriptor type */
0x10, /* USB 3.1 */
0x01,
0x00, /* Device class */
0x00, /* Device Sub-class */
0x00, /* Device Protocol */
0x09, /* Maxpacket size for EP0 : 2^9 */
0xB4, /* Vendor ID */
0x01, /* Product ID */
0x00, /* Device release number */
0x01, /* Manufacture string index */
0x02, /* Product string index */
0x00, /* Serial number string index */
0x01 /* Number of configurations */
/* Configuration Descriptor */
...
/* Video Streaming Interface Descriptor (Interface 1) */
...
/* Output Terminal Descriptor */
...
/* Unit Descriptor */
0x0B, /* Descriptor size */
CY_U3P_CS_INTRFC_DESCR, /* Class Specific Interface Descriptor Type */
0x04, /* Descriptor Sub Type : VS Input Header */
0x01, /* 1 Video Streaming interface */
0x00, /* No Still image capture methods supported */
0x00, /* No Supported for hardware trigger */
0x00, 0x00, 0x00, 0x00, /* Hardware trigger not supported */
0x00 /* No Supported for hardware to initiate still capture */
/* Endpoint Descriptor */
...
```
3. 根据新的bUnitEnable成员,在cyfxuvc.h文件中增加相应的函数和数据结构来支持新的功能。例如:
```cpp
typedef struct
{
uint8_t bUnitEnable; /* Enable/disable this unit. */
...
} CyFxUVCStillCaptUnit_t;
uint32_t CyFxUVCStillCaptStart (CyFxUVCStillCaptUnit_t *handle);
...
```
4. 在cyfxuvc.c文件中添加相应的函数来实现新的功能。例如:
```cpp
#include "cyfxuvc.h"
CyFxUVCStillCaptUnit_t UVCStillCaptUnit;
uint32_t CyFxUVCStillCaptStart (CyFxUVCStillCaptUnit_t *handle)
{
/* Add your code here to implement the still capture functionality. */
return CY_FX_UVC_STREAM_REQUEST_BUF_CNT;
}
```
5. 在cyfxuvcinmem.c文件中,修改```CyFxUVCApplnStop```函数,以停止视频流传输时也停止新的功能。例如:
```cpp
...
if (glIsApplnActive)
{
...
if (clearFeatureRqt)
{
...
}
/* Stop the still image capture functionality */
if (UVCStillCaptUnit.bUnitEnable)
{
pauseVideo = CyTrue;
}
}
...
```
6. 在cyfxuvcinmem.c文件中,修改```CyFxUVCApplnInit```函数,以初始化新的功能。例如:
```cpp
void CyFxUVCApplnInit (void)
{
...
UVCStillCaptUnit.bUnitEnable = CyTrue; /* Enable the new unit */
}
```
这样,你就成功地添加了Method 1支持的静态图像捕获功能。你可以通过初始化并启动函数```CyFxUVCStillCaptStart```来开始静态图像的捕获。
要实现Method 1支持的静态图像捕获功能,你需要进行以下步骤:
1. 在cyfxuvcdscr.h文件中,添加一个新的bUnitEnable成员,用于设置是否启用新的功能。例如:
```cpp
uint8_t bUnitEnable; /* Enable/disable this unit. */
```
2. 在cyfxuvcdscr.c文件中,修改Device Descriptor的定义,使其支持新的功能。例如:
```cpp
/* Device Descriptor */
const uint8_t CyFxUVCDscr[] __attribute__ ((aligned (32))) =
{
0x12, /* Descriptor size */
CY_U3P_USB_DEVICE_DESCR, /* Device descriptor type */
0x10, /* USB 3.1 */
0x01,
0x00, /* Device class */
0x00, /* Device Sub-class */
0x00, /* Device Protocol */
0x09, /* Maxpacket size for EP0 : 2^9 */
0xB4, /* Vendor ID */
0x01, /* Product ID */
0x00, /* Device release number */
0x01, /* Manufacture string index */
0x02, /* Product string index */
0x00, /* Serial number string index */
0x01 /* Number of configurations */
/* Configuration Descriptor */
...
/* Video Streaming Interface Descriptor (Interface 1) */
...
/* Output Terminal Descriptor */
...
/* Unit Descriptor */
0x0B, /* Descriptor size */
CY_U3P_CS_INTRFC_DESCR, /* Class Specific Interface Descriptor Type */
0x04, /* Descriptor Sub Type : VS Input Header */
0x01, /* 1 Video Streaming interface */
0x00, /* No Still image capture methods supported */
0x00, /* No Supported for hardware trigger */
0x00, 0x00, 0x00, 0x00, /* Hardware trigger not supported */
0x00 /* No Supported for hardware to initiate still capture */
/* Endpoint Descriptor */
...
```
3. 根据新的bUnitEnable成员,在cyfxuvc.h文件中增加相应的函数和数据结构来支持新的功能。例如:
```cpp
typedef struct
{
uint8_t bUnitEnable; /* Enable/disable this unit. */
...
} CyFxUVCStillCaptUnit_t;
uint32_t CyFxUVCStillCaptStart (CyFxUVCStillCaptUnit_t *handle);
...
```
4. 在cyfxuvc.c文件中添加相应的函数来实现新的功能。例如:
```cpp
#include "cyfxuvc.h"
CyFxUVCStillCaptUnit_t UVCStillCaptUnit;
uint32_t CyFxUVCStillCaptStart (CyFxUVCStillCaptUnit_t *handle)
{
/* Add your code here to implement the still capture functionality. */
return CY_FX_UVC_STREAM_REQUEST_BUF_CNT;
}
```
5. 在cyfxuvcinmem.c文件中,修改```CyFxUVCApplnStop```函数,以停止视频流传输时也停止新的功能。例如:
```cpp
...
if (glIsApplnActive)
{
...
if (clearFeatureRqt)
{
...
}
/* Stop the still image capture functionality */
if (UVCStillCaptUnit.bUnitEnable)
{
pauseVideo = CyTrue;
}
}
...
```
6. 在cyfxuvcinmem.c文件中,修改```CyFxUVCApplnInit```函数,以初始化新的功能。例如:
```cpp
void CyFxUVCApplnInit (void)
{
...
UVCStillCaptUnit.bUnitEnable = CyTrue; /* Enable the new unit */
}
```
这样,你就成功地添加了Method 1支持的静态图像捕获功能。你可以通过初始化并启动函数```CyFxUVCStillCaptStart```来开始静态图像的捕获。
举报