CH374實(shí)現(xiàn)HID的問題

用CH374做HID鍵盤設(shè)備。 是單一的鍵盤,不帶任何其它設(shè)備。 端點(diǎn)描述符如下: U08 EP1_HID_Des[] = { HID_UsagePage(HID_USAGE_PAGE_GENERIC), //05 01 HID_Usage(HID_USAGE_GENERIC_KEYBOARD), //09 06 HID_Collection(HID_Application), //A1 01 HID_ReportSize(1), //75 01 HID_ReportCount(8), //95 08 HID_UsagePage(HID_USAGE_PAGE_KEYBOARD), //05 07 HID_UsageMin(HID_USAGE_KEYBOARD_LCTRL), //19 E0 HID_UsageMax(HID_USAGE_KEYBOARD_RGUI), //29 E7 HID_LogicalMin(0), //15 00 HID_LogicalMax(1), //25 01 HID_Input(HID_Data + HID_Variable + HID_Absolute), //81 02 HID_ReportCount(1), //95 01 HID_ReportSize(8), //75 08 HID_Input(HID_Constant), //81 01 HID_ReportCount(5), //95 05 HID_ReportSize(1), //75 01 HID_UsagePage(HID_USAGE_PAGE_LED), //05 08 HID_UsageMin(HID_USAGE_LED_NUM_LOCK), //19 01 HID_UsageMax(HID_USAGE_LED_KANA), //29 05 HID_Output(HID_Data + HID_Variable + HID_Absolute), //91 02 HID_ReportCount(1), //95 01 HID_ReportSize(3), //75 03 HID_Output(HID_Constant), //91 01 HID_ReportCount(6), //95 06 HID_ReportSize(8), //75 08 HID_LogicalMin(0), //15 00 HID_LogicalMax(255), //25 FF HID_UsagePage(HID_USAGE_PAGE_KEYBOARD), //05 07 HID_UsageMin(0), //19 00 HID_UsageMax(255), //29 FF HID_Input(HID_Data + HID_Array), //81 00 HID_EndCollection //0xc0 }; 發(fā)送數(shù)據(jù)時(shí)往緩沖區(qū)寫出數(shù)據(jù) Write374Block( RAM_ENDP1_TRAN, 8, upBuf ); 在這之后還應(yīng)該寫什么命令把數(shù)據(jù)發(fā)送到USB總線呢? 還有,發(fā)送了控制指示燈的指令后,PC機(jī)的回復(fù)狀態(tài)從哪里取到? [Emot]13[/Emot]

Write374Byte( REG_USB_ENDP1, M_SET_EP1_TRAN_ACK( Read374Byte( REG_USB_ENDP1 ) )) 只要寫ACK就可以了


劉工: 還有一個(gè)參數(shù): M_SET_EP1_TRAN_ACK( old, len ) 是填發(fā)送數(shù)據(jù)的總長(zhǎng)度? 那就是這樣子。 Write374Byte( REG_USB_ENDP1, M_SET_EP1_TRAN_ACK( Read374Byte( REG_USB_ENDP1 )^ BIT_EP1_RECV_TOG, 8));

對(duì)了不?


不好意思,我忘記這個(gè)長(zhǎng)度的參數(shù)了。 這樣就可以了: Write374Byte( REG_USB_ENDP1, M_SET_EP1_TRAN_ACK( Read374Byte( REG_USB_ENDP1 ) 8)); 為什么不^ BIT_EP1_RECV_TOG是因?yàn)樵诎l(fā)送完畢中斷里進(jìn)行了)^ BIT_EP1_RECV_TOG這個(gè)操作,你可以在代碼中搜索看一下。


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

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