是我回传的数据格式有问题吗,求大佬讲解
/**键盘HID值上传函数**/
void HIDValueHandle1()
{
TR0 = 0;
FLAG = 0;
Enp1IntIn(); //USB设备模式端点1的中断上传
while(FLAG == 0);
FLAG = 0;
memset(&HIDKey[0],0,8);
Enp1IntIn();
while(FLAG == 0);
TR0 = 1;
}
/**多媒体按键HID值上传函数**/
void HIDValueHandle2()
{
TR0 = 0;
Enp2IntIn(); //USB设备模式端点2的中断上传
memset(&HIDKeyMUL[0],0,4);
Enp2IntIn();
TR0 = 1;
}
/**按键行为函数**/
void KeyAction(unsigned char keyCode)
{
if(keyCode == 0x31)//按键A
{
HIDKeyMUL[0] = 0x06;
HIDKeyMUL[3] = 0xB6;
if(Ready)
{
HIDValueHandle2();
}
}
if(keyCode == 0x32)//按键B
{
HIDKeyMUL[0] = 0x06;
HIDKeyMUL[3] = 0xE9;
if(Ready)
{
HIDValueHandle2();
}
}
if(keyCode == 0x33) //按键C
{
HIDKey[2] = 0x06;
if(Ready)
{
HIDValueHandle1();
}
}
}
/*多媒体键盘报表描述符*/
UINT8C KeyMULRepDesc[105] =
{
0x05, 0x0C, //USAGE_PAGE 用途页选择0x0c(用户页)
0x09, 0x01, //USAGE 接下来的应用集合用于用户控制
0xA1, 0x01, //COLLECTION 开集合
0x15, 0x00, //LOGICAL_MINIMUM (0)
0x25, 0x01, //LOGICAL_MAXIMUM (1)
0x0A, 0xEA, 0x00, /* Usage( Vol- ) */
0x0A, 0xE9, 0x00, /* Usage( Vol+ ) */
0x0A, 0xE2, 0x00, /* Usage( Mute ) */
0x0A, 0x8A, 0x01, /* Usage( Email ) */
0x0A, 0x83, 0x01, /* Usage( Media ) */
0x0A, 0x23, 0x02, /* Usage( WWW Home ) */
0x0A, 0xCD, 0x00, /* Usage( Play/Pause ) */
0x0A, 0xB6, 0x00, /* Usage( Scan Pre Track ) */
0x0A, 0xB5, 0x00, /* Usage( Scan Next Track ) */
0x0A, 0xB7, 0x00, /* Usage( Stop ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x00, 0x00, /* Usage( NULL ) */
0x0A, 0x11, 0x22, /* Usage( NULL ) */
0x75, 0x01, //REPORT_SIZE (1)
0x95, 0x18, //REPORT_COUNT (24)
0x81, 0x02, //INPUT (Data,Var,Abs)输入24bit数据
0x05, 0x01, //USAGE_PAGE 用途页0x01(普通桌面)
0x19, 0x00, //USAGE_MINIMUM 用途最小值0x00(未定义)
0x29, 0x83, //USAGE_MAXIMUM 用途最大值0x83(系统唤醒)
0x15, 0x00, //LOGICAL_MINIMUM (0)
0x25, 0x83, //LOGICAL_MAXIMUM (1)
0x75, 0x08, //REPORT_SIZE (8)
0x95, 0x01, //REPORT_COUNT (1)
0x81, 0x00, //INPUT (Data,Ary,Abs)输入1字节数据
0xC0//END_COLLECTION 闭合集合
};
|