1
0
mirror of https://github.com/whowechina/chu_pico.git synced 2024-11-24 11:00:10 +01:00

Small progress, USB working now.

This commit is contained in:
whowechina 2023-09-07 22:34:53 +08:00
parent 77efaa66d4
commit e44968e5ea
4 changed files with 12 additions and 9 deletions

View File

@ -174,6 +174,8 @@ void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id,
printf("Slider 15: %d\n", bufsize);
} else if (report_id == REPORT_ID_LED_TOWER_6) {
printf("Tower 6: %d\n", bufsize);
} else {
printf("Report: %d - %d\n", report_id, bufsize);
}
}
}

View File

@ -102,12 +102,10 @@ void slider_update_baseline()
if (iteration > 100) {
iteration = 0;
printf("B: ");
for (int i = 0; i < 32; i++) {
if (error[i] > 100) {
baseline[i] ++;
printf("+");
} else if (error[i] < -100) {
baseline[i] --;
printf("-");

View File

@ -51,8 +51,11 @@ tusb_desc_device_t desc_device_joy = {
.bDeviceProtocol = 0x00,
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
.idVendor = 0xcf0d,
.idProduct = 0x4032,
// To match CrazyRedMachine dll
// vid 0x0f0d, pid 0x0092, interface 1
.idVendor = 0x0f0d,
.idProduct = 0x0092,
.bcdDevice = 0x0100,
.iManufacturer = 0x01,
@ -91,9 +94,10 @@ uint8_t const* tud_hid_descriptor_report_cb(uint8_t itf)
if (itf == 0) {
return desc_hid_report_joy;
}
else {
else if (itf == 1) {
return desc_hid_report_led;
}
return NULL;
}
//--------------------------------------------------------------------+
// Configuration Descriptor
@ -148,7 +152,7 @@ const char *string_desc_arr[] = {
(const char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
"WHowe" , // 1: Manufacturer
"Chu Pico Controller", // 2: Product
"333434", // 3: Serials, should use chip ID
"123456", // 3: Serials, should use chip ID
"Joystick Interface",
"LED Interface",
"Serial Port",

View File

@ -103,11 +103,10 @@ enum {
#define GAMECON_REPORT_DESC_LED_COMPRESSED(...) \
HID_USAGE_PAGE(HID_USAGE_PAGE_DESKTOP), HID_USAGE(0x00), \
HID_COLLECTION(HID_COLLECTION_APPLICATION), \
__VA_ARGS__ HID_REPORT_COUNT(62), HID_REPORT_SIZE(8), \
__VA_ARGS__ HID_REPORT_COUNT(63), HID_REPORT_SIZE(8), \
HID_LOGICAL_MIN(0x00), HID_LOGICAL_MAX_N(0x00ff, 2), \
HID_USAGE_PAGE(HID_USAGE_PAGE_ORDINAL), \
HID_STRING_MINIMUM(4), HID_STRING_MAXIMUM(16), \
HID_USAGE_MIN(1), HID_USAGE_MAX(62), \
HID_USAGE_MIN(1), HID_USAGE_MAX(63), \
HID_OUTPUT(HID_DATA | HID_VARIABLE | HID_ABSOLUTE), \
HID_REPORT_COUNT(1), HID_REPORT_SIZE(8), \
HID_INPUT(HID_CONSTANT | HID_VARIABLE | HID_ABSOLUTE), \