mirror of
https://github.com/whowechina/chu_pico.git
synced 2024-11-24 19:10:11 +01:00
Small progress, USB working now.
This commit is contained in:
parent
77efaa66d4
commit
e44968e5ea
@ -174,6 +174,8 @@ void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id,
|
|||||||
printf("Slider 15: %d\n", bufsize);
|
printf("Slider 15: %d\n", bufsize);
|
||||||
} else if (report_id == REPORT_ID_LED_TOWER_6) {
|
} else if (report_id == REPORT_ID_LED_TOWER_6) {
|
||||||
printf("Tower 6: %d\n", bufsize);
|
printf("Tower 6: %d\n", bufsize);
|
||||||
|
} else {
|
||||||
|
printf("Report: %d - %d\n", report_id, bufsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,12 +102,10 @@ void slider_update_baseline()
|
|||||||
|
|
||||||
if (iteration > 100) {
|
if (iteration > 100) {
|
||||||
iteration = 0;
|
iteration = 0;
|
||||||
printf("B: ");
|
|
||||||
for (int i = 0; i < 32; i++) {
|
for (int i = 0; i < 32; i++) {
|
||||||
if (error[i] > 100) {
|
if (error[i] > 100) {
|
||||||
baseline[i] ++;
|
baseline[i] ++;
|
||||||
printf("+");
|
printf("+");
|
||||||
|
|
||||||
} else if (error[i] < -100) {
|
} else if (error[i] < -100) {
|
||||||
baseline[i] --;
|
baseline[i] --;
|
||||||
printf("-");
|
printf("-");
|
||||||
|
@ -51,8 +51,11 @@ tusb_desc_device_t desc_device_joy = {
|
|||||||
.bDeviceProtocol = 0x00,
|
.bDeviceProtocol = 0x00,
|
||||||
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
|
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
|
||||||
|
|
||||||
.idVendor = 0xcf0d,
|
// To match CrazyRedMachine dll
|
||||||
.idProduct = 0x4032,
|
// vid 0x0f0d, pid 0x0092, interface 1
|
||||||
|
|
||||||
|
.idVendor = 0x0f0d,
|
||||||
|
.idProduct = 0x0092,
|
||||||
.bcdDevice = 0x0100,
|
.bcdDevice = 0x0100,
|
||||||
|
|
||||||
.iManufacturer = 0x01,
|
.iManufacturer = 0x01,
|
||||||
@ -91,9 +94,10 @@ uint8_t const* tud_hid_descriptor_report_cb(uint8_t itf)
|
|||||||
if (itf == 0) {
|
if (itf == 0) {
|
||||||
return desc_hid_report_joy;
|
return desc_hid_report_joy;
|
||||||
}
|
}
|
||||||
else {
|
else if (itf == 1) {
|
||||||
return desc_hid_report_led;
|
return desc_hid_report_led;
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Configuration Descriptor
|
// Configuration Descriptor
|
||||||
@ -148,7 +152,7 @@ const char *string_desc_arr[] = {
|
|||||||
(const char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
|
(const char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
|
||||||
"WHowe" , // 1: Manufacturer
|
"WHowe" , // 1: Manufacturer
|
||||||
"Chu Pico Controller", // 2: Product
|
"Chu Pico Controller", // 2: Product
|
||||||
"333434", // 3: Serials, should use chip ID
|
"123456", // 3: Serials, should use chip ID
|
||||||
"Joystick Interface",
|
"Joystick Interface",
|
||||||
"LED Interface",
|
"LED Interface",
|
||||||
"Serial Port",
|
"Serial Port",
|
||||||
|
@ -103,11 +103,10 @@ enum {
|
|||||||
#define GAMECON_REPORT_DESC_LED_COMPRESSED(...) \
|
#define GAMECON_REPORT_DESC_LED_COMPRESSED(...) \
|
||||||
HID_USAGE_PAGE(HID_USAGE_PAGE_DESKTOP), HID_USAGE(0x00), \
|
HID_USAGE_PAGE(HID_USAGE_PAGE_DESKTOP), HID_USAGE(0x00), \
|
||||||
HID_COLLECTION(HID_COLLECTION_APPLICATION), \
|
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_LOGICAL_MIN(0x00), HID_LOGICAL_MAX_N(0x00ff, 2), \
|
||||||
HID_USAGE_PAGE(HID_USAGE_PAGE_ORDINAL), \
|
HID_USAGE_PAGE(HID_USAGE_PAGE_ORDINAL), \
|
||||||
HID_STRING_MINIMUM(4), HID_STRING_MAXIMUM(16), \
|
HID_USAGE_MIN(1), HID_USAGE_MAX(63), \
|
||||||
HID_USAGE_MIN(1), HID_USAGE_MAX(62), \
|
|
||||||
HID_OUTPUT(HID_DATA | HID_VARIABLE | HID_ABSOLUTE), \
|
HID_OUTPUT(HID_DATA | HID_VARIABLE | HID_ABSOLUTE), \
|
||||||
HID_REPORT_COUNT(1), HID_REPORT_SIZE(8), \
|
HID_REPORT_COUNT(1), HID_REPORT_SIZE(8), \
|
||||||
HID_INPUT(HID_CONSTANT | HID_VARIABLE | HID_ABSOLUTE), \
|
HID_INPUT(HID_CONSTANT | HID_VARIABLE | HID_ABSOLUTE), \
|
||||||
|
Loading…
Reference in New Issue
Block a user