/********************************** (C) COPYRIGHT ******************************* * File Name : main.c * Author : WCH * Version : V1.0.0 * Date : 2021/08/08 * Description : Main program body. ********************************************************************************* * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. * Attention: This software (modified or not) and binary are used for * microcontroller manufactured by Nanjing Qinheng Microelectronics. *******************************************************************************/ /* @Note * Compatibility HID Example: * This program provides examples of the pass-through of USB-HID data and serial port * data based on compatibility HID device. And the data returned by Get_Report request is * the data sent by the last Set_Report request.Speed of UART1/2 is 115200bps. * * Interrupt Transfers: * UART2_RX ---> Endpoint2 * Endpoint1 ---> UART2_TX * * Note that the first byte is the valid data length and the remaining bytes are * the transmission data for interrupt Transfers. * * Control Transfers: * Set_Report ---> UART1_TX * Get_Report <--- last Set_Report packet * * */ #include "debug.h" #include "usb_lib.h" #include "usb_desc.h" #include "hw_config.h" #include "usb_pwr.h" #include "usb_prop.h" #include "usbd_compatibility_hid.h" /* Global define */ /* Global Variable */ /********************************************************************* * @fn Var_Init * * @brief Software parameter initialization * * @return none */ void Var_Init(void) { uint16_t i; RingBuffer_Comm.LoadPtr = 0; RingBuffer_Comm.StopFlag = 0; RingBuffer_Comm.DealPtr = 0; RingBuffer_Comm.RemainPack = 0; for(i=0; i