TMC32_QJB/HID/HID_keyboard.c
2026-04-30 16:23:12 +08:00

635 lines
18 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/********************************************************************************
* Copyright (c) 2016, Beijing Tongfang Microelectroics Co., Ltd.
* All rights reserved.
* Module: HID class response
* Author: Yang Song
* Version: V1.0
* History:
* 2016-09-22 Original version
********************************************************************************/
#include "global.h"
//Keyboard HID 按键编码
//0x00 Reserved (no event indicated)
//0x01 Keyboard ErrorRollOver
//0x02 Keyboard POSTFail
//0x03 Keyboard ErrorUndefined
//0x04 Keyboard a and A
//0x05 Keyboard b and B
//0x06 Keyboard c and C
//0x07 Keyboard d and D
//0x08 Keyboard e and E
//0x09 Keyboard f and F
//0x0A Keyboard g and G
//0x0B Keyboard h and H
//0x0C Keyboard i and I
//0x0D Keyboard j and J
//0x0E Keyboard k and K
//0x0F Keyboard l and L
//0x10 Keyboard m and M
//0x11 Keyboard n and N
//0x12 Keyboard o and O
//0x13 Keyboard p and P
//0x14 Keyboard q and Q
//0x15 Keyboard r and R
//0x16 Keyboard s and S
//0x17 Keyboard t and T
//0x18 Keyboard u and U
//0x19 Keyboard v and V
//0x1A Keyboard w and W
//0x1B Keyboard x and X
//0x1C Keyboard y and Y
//0x1D Keyboard z and Z
//0x1E Keyboard 1 and !
//0x1F Keyboard 2 and @
//0x20 Keyboard 3 and #
//0x21 Keyboard 4 and $
//0x22 Keyboard 5 and %
//0x23 Keyboard 6 and ^
//0x24 Keyboard 7 and &
//0x25 Keyboard 8 and *
//0x26 Keyboard 9 and (
//0x27 Keyboard 0 and )
//0x28 Keyboard Return (ENTER)
//0x29 Keyboard ESCAPE
//0x2A Keyboard DELETE (Backspace)
//0x2B Keyboard Tab
//0x2C Keyboard Spacebar
//0x2D Keyboard - and _(underscore)
//0x2E Keyboard = and +
//0x2F Keyboard [ and {
//0x30 Keyboard ] and }
//0x31 Keyboard \ and |
//0x32 Keyboard Non-US # and ~
//0x33 Keyboard ; and :
//0x34 Keyboard ' and "
//0x35 Keyboard Grave Accent and Tilde == ` and ~
//0x36 Keyboard , and <
//0x37 Keyboard . and >
//0x38 Keyboard / and ?
//0x39 Keyboard Caps Lock
//0x3A Keyboard F1
//0x3B Keyboard F2
//0x3C Keyboard F3
//0x3D Keyboard F4
//0x3E Keyboard F5
//0x3F Keyboard F6
//0x40 Keyboard F7
//0x41 Keyboard F8
//0x42 Keyboard F9
//0x43 Keyboard F10
//0x44 Keyboard F11
//0x45 Keyboard F12
//0x46 Keyboard PrintScreen
//0x47 Keyboard Scroll Lock
//0x48 Keyboard Pause
//0x49 Keyboard Insert
//0x4A Keyboard Home
//0x4B Keyboard PageUp
//0x4C Keyboard Delete Forward
//0x4D Keyboard End
//0x4E Keyboard PageDown
//0x4F Keyboard RightArrow
//0x50 Keyboard LeftArrow
//0x51 Keyboard DownArrow
//0x52 Keyboard UpArrow
//0x53 Keypad Num Lock and Clear
//0x54 Keypad /
//0x55 Keypad *
//0x56 Keypad -
//0x57 Keypad +
//0x58 Keypad ENTER
//0x59 Keypad 1 and End
//0x5A Keypad 2 and Down Arrow
//0x5B Keypad 3 and PageDn
//0x5C Keypad 4 and Left Arrow
//0x5D Keypad 5
//0x5E Keypad 6 and Right Arrow
//0x5F Keypad 7 and Home
//0x60 Keypad 8 and Up Arrow
//0x61 Keypad 9 and PageUp
//0x62 Keypad 0 and Insert
//0x63 Keypad . and Delete
//0x64 Keyboard Non-US \ and |
//0x65 Keyboard Application
//0x66 Keyboard Power
//0x67 Keypad =
//0x68 Keyboard F13
//0x69 Keyboard F14
//0x6A Keyboard F15
//0x6B Keyboard F16
//0x6C Keyboard F17
//0x6D Keyboard F18
//0x6E Keyboard F19
//0x6F Keyboard F20
//0x70 Keyboard F21
//0x71 Keyboard F22
//0x72 Keyboard F23
//0x73 Keyboard F24
//0x74 Keyboard Execute
//0x75 Keyboard Help
//0x76 Keyboard Menu
//0x77 Keyboard Select
//0x78 Keyboard Stop
//0x79 Keyboard Again
//0x7A Keyboard Undo
//0x7B Keyboard Cut
//0x7C Keyboard Copy
//0x7D Keyboard Paste
//0x7E Keyboard Find
//0x7F Keyboard Mute
//0x80 Keyboard Volume Up
//0x81 Keyboard Volume Down
//0x82 Keyboard Locking Caps Lock
//0x83 Keyboard Locking Num Lock
//0x84 Keyboard Locking Scroll Lock
//0x85 Keypad Comma
//0x86 Keypad Equal Sign
//0x87 Keyboard International1
//0x88 Keyboard International2
//0x89 Keyboard International3
//0x8A Keyboard International4
//0x8B Keyboard International5
//0x8C Keyboard International6
//0x8D Keyboard International7
//0x8E Keyboard International8
//0x8F Keyboard International9
//0x90 Keyboard LANG1
//0x91 Keyboard LANG2
//0x92 Keyboard LANG3
//0x93 Keyboard LANG4
//0x94 Keyboard LANG5
//0x95 Keyboard LANG6
//0x96 Keyboard LANG7
//0x97 Keyboard LANG8
//0x98 Keyboard LANG9
//0x99 Keyboard Alternate Erase
//0x9A Keyboard SysReq/Attention
//0x9B Keyboard Cancel
//0x9C Keyboard Clear
//0x9D Keyboard Prior
//0x9E Keyboard Return
//0x9F Keyboard Separator
//0xA0 Keyboard Out
//0xA1 Keyboard Oper
//0xA2 Keyboard Clear/Again
//0xA3 Keyboard CrSel/Props
//0xA4 Keyboard ExSel
//0xE0 Keyboard LeftControl
//0xE1 Keyboard LeftShift
//0xE2 Keyboard LeftAlt
//0xE3 Keyboard Left GUI
//0xE4 Keyboard RightControl
//0xE5 Keyboard RightShift
//0xE6 Keyboard RightAlt
//0xE7 Keyboard Right GUI
/**------------------------------
*USB键盘数据包含8个字节
*
*BYTE1 -- 特殊按键
*
* |--bit0: Left Control是否按下按下为1
* |--bit1: Left Shift 是否按下按下为1 -------这里切换后者
* |--bit2: Left Alt 是否按下按下为1
* |--bit3: Left GUIWindows键 是否按下按下为1
* |--bit4: Right Control是否按下按下为1
* |--bit5: Right Shift 是否按下按下为1
* |--bit6: Right Alt 是否按下按下为1
* |--bit7: Right GUI 是否按下按下为1
*
*BYTE2 -- 好像必须为0反正0没错
*BYTE3-BYTE8 当前按下的普通按键键值,也就是最多六个按键
*/
//本转换表对8字节的安排第一个字节表示BYTE1 第二字节表示BYTE3其余字节请自行补零
//另,本表只转换全部可见字符,且可见字符,有的有多种表示方式,这里只取其中一种。
const unsigned char Ascii2HidKbdChars_Table[127-32][2]=
{
0x00, 0x2C,//32 0x20 spacebar
0x02, 0x1E,//33 0x21 !
0x02, 0x34,//34 0x22 "
0x02, 0x20,//35 0x23 #
0x02, 0x21,//36 0x24 $
0x02, 0x22,//37 0x25 %
0x02, 0x24,//38 0x26 &
0x00, 0x34,//39 0x27 '
0x02, 0x26,//40 0x28 (
0x02, 0x27,//41 0x29 )
0x02, 0x25,//42 0x2A *
0x02, 0x2E,//43 0x2B +
0x00, 0x36,//44 0x2C ,
0x00, 0x2D,//45 0x2D -
0x00, 0x37,//46 0x2E .
0x00, 0x38,//47 0x2F /
0x00, 0x27,//48 0x30 0
0x00, 0x1E,//49 0x31 1
0x00, 0x1F,//50 0x32 2
0x00, 0x20,//51 0x33 3
0x00, 0x21,//52 0x34 4
0x00, 0x22,//53 0x35 5
0x00, 0x23,//54 0x36 6
0x00, 0x24,//55 0x37 7
0x00, 0x25,//56 0x38 8
0x00, 0x26,//57 0x39 9
0x02, 0x33,//58 0x3A :
0x00, 0x33,//59 0x3B ;
0x02, 0x36,//60 0x3C <
0x00, 0x2E,//61 0x3D =
0x02, 0x37,//62 0x3E >
0x02, 0x38,//63 0x3F ?
0x02, 0x1F,//64 0x40 @
0x02, 0x04,//65 0x41 A
0x02, 0x05,//66 0x42 B
0x02, 0x06,//67 0x43 C
0x02, 0x07,//68 0x44 D
0x02, 0x08,//69 0x45 E
0x02, 0x09,//70 0x46 F
0x02, 0x0A,//71 0x47 G
0x02, 0x0B,//72 0x48 H
0x02, 0x0C,//73 0x49 I
0x02, 0x0D,//74 0x4A J
0x02, 0x0E,//75 0x4B K
0x02, 0x0F,//76 0x4C L
0x02, 0x10,//77 0x4D M
0x02, 0x11,//78 0x4E N
0x02, 0x12,//79 0x4F O
0x02, 0x13,//80 0x50 P
0x02, 0x14,//81 0x51 Q
0x02, 0x15,//82 0x52 R
0x02, 0x16,//83 0x53 S
0x02, 0x17,//84 0x54 T
0x02, 0x18,//85 0x55 U
0x02, 0x19,//86 0x56 V
0x02, 0x1A,//87 0x57 W
0x02, 0x1B,//88 0x58 X
0x02, 0x1C,//89 0x59 Y
0x02, 0x1D,//90 0x5A Z
0x00, 0x2F,//91 0x5B [
0x00, 0x31,//92 0x5C '\'
0x00, 0x30,//93 0x5D ]
0x02, 0x23,//94 0x5E ^
0x02, 0x2D,//95 0x5F _
0x00, 0x35,//96 0x60 `
0x00, 0x04,//97 0x61 a
0x00, 0x05,//98 0x62 b
0x00, 0x06,//99 0x63 c
0x00, 0x07,//100 0x64 d
0x00, 0x08,//101 0x65 e
0x00, 0x09,//102 0x66 f
0x00, 0x0A,//103 0x67 g
0x00, 0x0B,//104 0x68 h
0x00, 0x0C,//105 0x69 i
0x00, 0x0D,//106 0x6A j
0x00, 0x0E,//107 0x6B k
0x00, 0x0F,//108 0x6C l
0x00, 0x10,//109 0x6D m
0x00, 0x11,//110 0x6E n
0x00, 0x12,//111 0x6F o
0x00, 0x13,//112 0x70 p
0x00, 0x14,//113 0x71 q
0x00, 0x15,//114 0x72 r
0x00, 0x16,//115 0x73 s
0x00, 0x17,//116 0x74 t
0x00, 0x18,//117 0x75 u
0x00, 0x19,//118 0x76 v
0x00, 0x1A,//119 0x77 w
0x00, 0x1B,//120 0x78 x
0x00, 0x1C,//121 0x79 y
0x00, 0x1D,//122 0x7A z
0x02, 0x2F,//123 0x7B {
0x02, 0x31,//124 0x7C |
0x02, 0x30,//125 0x7D }
0x02, 0x35,//126 0x7E ~
};
/**
* 汉字发送原理:
*
* Alt+小键盘编码,用于发送汉字内码;---TXT文件是按照GBK解码的Word是按照Unicode解码的。
* 按照十进制,高位先的原则,发送。
* 汉字编码位于0x81XX33024之后因此肯定需要发送5个按键。
* 例如:中 0xD6D0, 54992, 应发送 ALT 5 4 9 9 2 (发送数字期间ALT不抬起)
*/
// 小键盘编码
const u8 LittleKeyboard_Table[10]=
{
0x62, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61
};
void usbHidKbdSendCharsGBK(unsigned char *ascii_chars, unsigned int len)
{
unsigned int i, j;
u16 cnchar;
u16 cncharlen;
u16 div; // 用于16进制转10进制
memset(g_abUsbEp2Buf,0,8);
//如果支持GBK模式
for (i=0; i<len; i++)
{
if ((ascii_chars[i]>=' ') && (ascii_chars[i] <= '~')) //目前只发送可见字符
{
//每次只传输一个字符,别人家也是每次一个
g_abUsbEp2Buf[0] = Ascii2HidKbdChars_Table[ascii_chars[i]-32][0];
g_abUsbEp2Buf[2] = Ascii2HidKbdChars_Table[ascii_chars[i]-32][1];
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从有效报文到释放报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
memset(g_abUsbEp2Buf,0,8);
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
else if ((ascii_chars[i] == 0x0D) || (ascii_chars[i] == 0x0A))
{
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x28;
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从有效报文到释放报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x00;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
else if (ascii_chars[i] == 0x09)
{
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x2B;
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从有效报文到释放报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x00;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
else if(ascii_chars[i] >= 0x80)
{
//设置的汉字内码的发送TXT文件是按照GBK解码的Word是按照Unicode解码的。如果要GKB和Unicode转码还需要转换表格。
if (i <= len-2) //本字节之后,至少还有一个字节,此时,把本字节和后续字节当成一个汉字处理,按照汉字内码方式传输。
{
cnchar = (ascii_chars[i]<<8) + ascii_chars[i+1]; //两字节先转为一个汉字内码
i++;//跳过一个字节。
cncharlen = 5;
div = 10000;
}
else
{
cnchar = ascii_chars[i];
cncharlen = 3;
div = 10000;
}
//发送一个汉字
g_abUsbEp2Buf[0] = 0x04; // 按下Left Alt
for(j=0;j<cncharlen;j++)
{
g_abUsbEp2Buf[2] = LittleKeyboard_Table[cnchar / div];
cnchar = cnchar % div; //先传输高位 MSB
div = div / 10;
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从有效报文到释放报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
g_abUsbEp2Buf[2] = 0x00;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
// 发送弹起 Left Alt
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x00;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
}
}
void usbHidKbdSendCharsUNICODE(unsigned char *ascii_chars, unsigned int len)
{
unsigned int i, j;
u16 cnchar;
memset(g_abUsbEp2Buf,0,8);
for (i=0; i< len; i += 2)
{
if(ascii_chars[i] == 0x00)
{
if((ascii_chars[i + 1] == 0x0D) || (ascii_chars[i + 1] == 0x0A))
{
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x28;
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x00;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
continue;
}
else if(ascii_chars[i + 1] == 0x09)
{
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x2B;
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x00;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
continue;
}
else if ((ascii_chars[i + 1]>=' ') && (ascii_chars[i + 1] <= '~')) //目前只发送可见字符
{
//每次只传输一个字符,别人家也是每次一个
g_abUsbEp2Buf[0] = Ascii2HidKbdChars_Table[ascii_chars[i + 1]-32][0];
g_abUsbEp2Buf[2] = Ascii2HidKbdChars_Table[ascii_chars[i + 1]-32][1];
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从有效报文到释放报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
memset(g_abUsbEp2Buf,0,8);
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
continue;
}
else
{
}
}
for(j=0; j< 2; j++)
{
cnchar = (((ascii_chars[i] << j*4)& 0xF0) >> 4);
if(cnchar < 10)
{
cnchar += '0';
}
else
{
cnchar += 'A' - 0x0a;
}
g_abUsbEp2Buf[0] = Ascii2HidKbdChars_Table[cnchar-32][0];
g_abUsbEp2Buf[2] = Ascii2HidKbdChars_Table[cnchar-32][1];
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从有效报文到释放报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
memset(g_abUsbEp2Buf,0,8);
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
for(j=0; j< 2; j++)
{
cnchar = (((ascii_chars[i + 1] << j*4)& 0xF0) >> 4);
if(cnchar < 10)
{
cnchar += '0';
}
else
{
cnchar += 'A' - 0x0a;
}
g_abUsbEp2Buf[0] = Ascii2HidKbdChars_Table[cnchar-32][0];
g_abUsbEp2Buf[2] = Ascii2HidKbdChars_Table[cnchar-32][1];
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从有效报文到释放报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
memset(g_abUsbEp2Buf,0,8);
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
//每隔两个发Alt+X
g_abUsbEp2Buf[0] = 0x04; // 按下Left Alt
g_abUsbEp2Buf[2] = 0x1b;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x00;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
}
void usbHidKbdSendCharsUTF8(unsigned char *ascii_chars, unsigned int len)
{
unsigned int i, j;
u8 cnchar;
memset(g_abUsbEp2Buf,0,8);
for (i=0; i< len; i++)
{
cnchar = ascii_chars[i];
if((cnchar & 0x80) == 0x80)
{
for(j=0; j< 2; j++)
{
cnchar = (((ascii_chars[i] << j*4)& 0xF0) >> 4);
if(cnchar < 10)
{
cnchar += '0';
}
else
{
cnchar += 'A' - 0x0a;
}
g_abUsbEp2Buf[0] = Ascii2HidKbdChars_Table[cnchar-32][0];
g_abUsbEp2Buf[2] = Ascii2HidKbdChars_Table[cnchar-32][1];
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从有效报文到释放报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
memset(g_abUsbEp2Buf,0,8);
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
}
else
{
if ((cnchar == 0x0D) || (cnchar == 0x0A))
{
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x28;
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x00;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
else if (cnchar == 0x09)
{
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x2B;
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x00;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBRelToValInterval);
}
else
{
g_abUsbEp2Buf[0] = Ascii2HidKbdChars_Table[cnchar-32][0];
g_abUsbEp2Buf[2] = Ascii2HidKbdChars_Table[cnchar-32][1];
//必须使用USB专用Buffer才能发送
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从有效报文到释放报文之间的间隔
g_abUsbEp2Buf[0] = 0x00;
g_abUsbEp2Buf[2] = 0x00;
usbEpnTxAll(2,g_abUsbEp2Buf,8);
//从释放报文到下一个有效报文之间的间隔
TimerDelay(TIM2, gConfgBuf.HIDKBValToRelInterval);
}
}
}
}