Skip to content

Commit 32228b9

Browse files
committed
update CMSIS_DAP and HID keyboard
Change HID PID. Remove the change for the 1st byte response in CMSIS-DAP.
1 parent 0ad4714 commit 32228b9

6 files changed

Lines changed: 17 additions & 7 deletions

File tree

ch55xduino/ch55x/libraries/Generic_Examples/examples/05.USB/CMSIS_DAP/CMSIS_DAP.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
1515
*/
1616

17+
//For windows user, if you ever played with other HID device with the same PID C55D
18+
//You may need to uninstall the previous driver completely
19+
1720

1821
#ifndef USER_USB_RAM
1922
#error "This example needs to be compiled with a USER USB setting"
@@ -30,9 +33,10 @@ void setup() {
3033
}
3134

3235
void loop() {
36+
uint8_t dapSendLength = 0;
3337
if (USBByteCountEP1) {
34-
DAP_Thread();
35-
USBByteCountEP1 = 0 ;
38+
dapSendLength = DAP_Thread();
39+
USBByteCountEP1 = 0;
3640

3741
UEP1_CTRL = UEP1_CTRL & ~ MASK_UEP_R_RES | UEP_R_RES_ACK; //enable receive
3842

ch55xduino/ch55x/libraries/Generic_Examples/examples/05.USB/CMSIS_DAP/src/CMSIS_DAPusb/DAP.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,9 +988,10 @@ static uint8_t DAP_WriteAbort(const uint8_t *req, uint8_t *res)
988988
}
989989

990990
// DAP Thread.
991-
void DAP_Thread(void)
991+
uint8_t DAP_Thread(void)
992992
{
993993
uint8_t num;
994+
uint8_t returnVal = 0;
994995

995996
if (1)
996997
{
@@ -1070,6 +1071,8 @@ void DAP_Thread(void)
10701071
break;
10711072
}
10721073

1073-
Ep1Buffer[64] = num + 1;
1074+
returnVal = num + 1;
10741075
}
1076+
1077+
return returnVal;
10751078
}

ch55xduino/ch55x/libraries/Generic_Examples/examples/05.USB/CMSIS_DAP/src/CMSIS_DAPusb/DAP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ extern __idata uint8_t turnaround;
213213
extern __idata uint8_t data_phase;
214214
extern __idata uint8_t idle_cycles;
215215

216-
extern void DAP_Thread(void);
216+
extern uint8_t DAP_Thread(void);
217217
extern void PORT_SWD_SETUP(void);
218218
extern uint8_t SWD_Transfer(uint8_t reqI, uint8_t __xdata *datas);
219219
extern void SWJ_Sequence(uint8_t count, const uint8_t *datas);

ch55xduino/ch55x/libraries/Generic_Examples/examples/05.USB/CMSIS_DAP/src/CMSIS_DAPusb/USBconstant.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ __code uint8_t DevDesc[] = {
77
0x10,0x01, //USB spec release number in BCD format, USB1.1 (0x10, 0x01).
88
0x00,0x00,0x00, //bDeviceClass, bDeviceSubClass, bDeviceProtocol
99
DEFAULT_ENDP0_SIZE, //PACKET_SIZE
10-
0x09,0x12,0x50,0xC5, // VID PID
10+
0x09,0x12,0x5D,0xC5, // VID PID
1111
0x00,0x01, //version
1212
0x01,0x02,0x03, //bString
1313
0x01 //bNumConfigurations

ch55xduino/ch55x/libraries/Generic_Examples/examples/05.USB/HidKeyboard/HidKeyboard.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
1010
*/
1111

12+
//For windows user, if you ever played with other HID device with the same PID C55D
13+
//You may need to uninstall the previous driver completely
14+
1215

1316
#ifndef USER_USB_RAM
1417
#error "This example needs to be compiled with a USER USB setting"

ch55xduino/ch55x/libraries/Generic_Examples/examples/05.USB/HidKeyboard/src/userUsbHidKeyboard/USBconstant.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ __code uint8_t DevDesc[] = {
77
0x10,0x01, //USB spec release number in BCD format, USB1.1 (0x10, 0x01).
88
0x00,0x00,0x00, //bDeviceClass, bDeviceSubClass, bDeviceProtocol
99
DEFAULT_ENDP0_SIZE, //bNumConfigurations
10-
0x09,0x12,0x50,0xC5, // VID PID
10+
0x09,0x12,0x5D,0xC5, // VID PID
1111
0x00,0x01, //version
1212
0x01,0x02,0x03, //bString
1313
0x01 //bNumConfigurations

0 commit comments

Comments
 (0)