• 欢迎光临~

usb vid pid 16进制定义

开发技术 开发技术 2022-11-01 次浏览
#include "stdafx.h"
#include <iostream>
using namespace std;
 
typedef unsigned          char uint8_t;

/* Following USB Device status */
typedef enum
{
    USBD_OK   = 0U,
    USBD_BUSY,
    USBD_FAIL,
} USBD_StatusTypeDef;

/* Following USB Device Speed */

typedef enum 

{

    USBD_SPEED_HIGH  = 0,

    USBD_SPEED_FULL  = 1,

    USBD_SPEED_LOW   = 2,  

}USBD_SpeedTypeDef;


/**
* @brief  PCD State structure definition
*/
typedef enum
{
    HAL_PCD_STATE_RESET   = 0x00,
    HAL_PCD_STATE_READY   = 0x01,
    HAL_PCD_STATE_ERROR   = 0x02,
    HAL_PCD_STATE_BUSY    = 0x03,
    HAL_PCD_STATE_TIMEOUT = 0x04

} PCD_StateTypeDef;

typedef enum
{
    USB_DEVICE_MODE  = 0
} USB_ModeTypeDef;
#define USBD_VID     0x1155
#define USBD_PID_FS     0x0644

#define LOBYTE(x)  ((uint8_t)((x) & 0x00FFU))
#define HIBYTE(x)  ((uint8_t)(((x) & 0xFF00U) >> 8U))

int main()
{
    USBD_SpeedTypeDef usbdok = USBD_SPEED_LOW;

//    LOBYTE(USBD_VID),           
//        HIBYTE(USBD_VID),          
//        LOBYTE(USBD_PID_FS),         
//        HIBYTE(USBD_PID_FS),       

    printf("%xn",HIBYTE(USBD_VID));
    printf("%x",LOBYTE(USBD_VID));
    system("PAUSE");
    return 0;
}

 

程序员灯塔
转载请注明原文链接:usb vid pid 16进制定义
喜欢 (0)
违法和不良信息举报电话:022-22558618 举报邮箱:dljd@tidljd.com