CH554全速和低速設(shè)置問題

CH554例程: 【EXAM_鍵盤鼠標(biāo)多媒體自定義HID\USB\Devie\CompositeKM.C】文件中的 Fullspeed全速或低速的選擇,是不是搞反了?請(qǐng)看下面的代碼


#define Fullspeed?????????????? 1

#ifdef? Fullspeed
#define THIS_ENDP0_SIZE???????? 64
#else
#define THIS_ENDP0_SIZE???????? 8? //低速USB,中斷傳輸、控制傳輸最大包長(zhǎng)度為8
#endif


#ifdef? Fullspeed?
??? 0x07,0x05,0x84,0x03,THIS_ENDP0_SIZE,0x00,0x01,????????????? //端點(diǎn)描述符(全速間隔時(shí)間改成1ms)
??? 0x07,0x05,0x04,0x03,THIS_ENDP0_SIZE,0x00,0x01,????????????? //端點(diǎn)描述符
#else
??? 0x07,0x05,0x84,0x03,THIS_ENDP0_SIZE,0x00,0x0A,????????????? //端點(diǎn)描述符(低速間隔時(shí)間最小10ms)
??? 0x07,0x05,0x04,0x03,THIS_ENDP0_SIZE,0x00,0x0A????????????? //端點(diǎn)描述符
#endif?


void CH554USBDevWakeup( )
{
#ifdef Fullspeed
?UDEV_CTRL |= bUD_LOW_SPEED;
?mDelaymS(2);
?UDEV_CTRL &= ~bUD_LOW_SPEED;??
#else
?UDEV_CTRL &= ~bUD_LOW_SPEED;
?mDelaymS(2);
?UDEV_CTRL |= bUD_LOW_SPEED;?
#endif
}


?IE_USB = 0;
?USB_CTRL = 0x00;?????????????????????????????????????????????????????????? // 先設(shè)定USB設(shè)備模式
?UDEV_CTRL = bUD_PD_DIS;??????????????????????????????????????????????????? // 禁止DP/DM下拉電阻

#ifndef Fullspeed
??? UDEV_CTRL |= bUD_LOW_SPEED;??????????????????????????????????????????????? //選擇低速1.5M模式
??? USB_CTRL |= bUC_LOW_SPEED;
#else
??? UDEV_CTRL &= ~bUD_LOW_SPEED;?????????????????????????????????????????????? //選擇全速12M模式,默認(rèn)方式
??? USB_CTRL &= ~bUC_LOW_SPEED;
#endif




CH554.H中的定義:

#define bUD_LOW_SPEED???? 0x04????? // enable USB physical port low speed: 0=full speed, 1=low speed





請(qǐng)問你是指代碼哪里有問題?


?如果Fullspeed為1, 是要執(zhí)行系列代碼吧?
#define THIS_ENDP0_SIZE???????? 8? //低速USB,中斷傳輸、控制傳輸最大包長(zhǎng)度為8

??? 0x07,0x05,0x84,0x03,THIS_ENDP0_SIZE,0x00,0x0A,????????????? //端點(diǎn)描述符(低速間隔時(shí)間最小10ms)
??? 0x07,0x05,0x04,0x03,THIS_ENDP0_SIZE,0x00,0x0A????????????? //端點(diǎn)描述符

?UDEV_CTRL &= ~bUD_LOW_SPEED;
?mDelaymS(2);
?UDEV_CTRL |= bUD_LOW_SPEED;

?UDEV_CTRL &= ~bUD_LOW_SPEED;?????????????????????????????????????????????? //選擇全速12M模式,默認(rèn)方式
?USB_CTRL &= ~bUC_LOW_SPEED;


代碼前面是#ifdef? Fullspeed ,后面是#ifndef Fullspeed,你前面的看錯(cuò)了


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频